From 955fcd35d074e7da25fd15ed3216423a30dc41cb Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 18 Nov 2016 14:35:20 +0000 Subject: [PATCH] Image: begin/end git-svn-id: svn://ultimatepp.org/upp/trunk@10462 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/src.tpp/CoWork$en-us.tpp | 4 ++-- uppsrc/Draw/Image.h | 2 ++ uppsrc/Draw/src.tpp/Image$en-us.tpp | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/uppsrc/Core/src.tpp/CoWork$en-us.tpp b/uppsrc/Core/src.tpp/CoWork$en-us.tpp index 691dcb7a1..949cf05c7 100644 --- a/uppsrc/Core/src.tpp/CoWork$en-us.tpp +++ b/uppsrc/Core/src.tpp/CoWork$en-us.tpp @@ -31,7 +31,7 @@ from various threads (CoWork is internally synchronized).&] global FIFO stack for 2048 scheduled jobs. When there is no slot available when scheduling the job, it is performed immediately by Do. Finish method has to wait until all jobs scheduled by -CoWork.instance are finished, while waiting it attempts to perform +CoWork instance are finished, while waiting it attempts to perform scheduled jobs from the same instance. That way work always progresses even if there is shortage of worker threads.&] [s0;%% &] @@ -46,7 +46,7 @@ tatic] [@(0.0.255) bool]_[* TrySchedule]([@(0.0.255) const]_[_^Upp`:`:Function^ [s2;%% This is a low`-level function that attempts to schedule [%-*@3 fn] to be executed by worker thread. Returns true if [%-*@3 fn] was scheduled, false if not (in case there is no slot left in scheduling -stacks). Not that this function only schedules the function, +stacks). Note that this function only schedules the function, the exact time of execution is unknown.&] [s3;%% &] [s4; &] diff --git a/uppsrc/Draw/Image.h b/uppsrc/Draw/Image.h index 5cea61a57..af57dbaa4 100644 --- a/uppsrc/Draw/Image.h +++ b/uppsrc/Draw/Image.h @@ -185,7 +185,9 @@ public: int GetResolution() const; const RGBA *Begin() const { return data ? ~data->buffer : NULL; } + const RGBA *begin() const { return Begin(); } const RGBA *End() const { return Begin() + GetLength(); } + const RGBA *end() const { return End(); } const RGBA* operator~() const { return Begin(); } operator const RGBA*() const { return Begin(); } const RGBA* operator[](int i) const { ASSERT(data); return data->buffer[i]; } diff --git a/uppsrc/Draw/src.tpp/Image$en-us.tpp b/uppsrc/Draw/src.tpp/Image$en-us.tpp index a96833de9..7dd439b66 100644 --- a/uppsrc/Draw/src.tpp/Image$en-us.tpp +++ b/uppsrc/Draw/src.tpp/Image$en-us.tpp @@ -88,11 +88,15 @@ for future use and returned.&] [s4; &] [s5;:Image`:`:Begin`(`)const: [@(0.0.255) const]_[_^RGBA^ RGBA]_`*[* Begin]()_[@(0.0.255) con st]&] +[s5;:Upp`:`:Image`:`:begin`(`)const: [@(0.0.255) const]_[_^Upp`:`:RGBA^ RGBA]_`*[* begin]() +_[@(0.0.255) const]&] [s2;%% Returns a pointer to the first pixel.&] [s3; &] [s4; &] [s5;:Image`:`:End`(`)const: [@(0.0.255) const]_[_^RGBA^ RGBA]_`*[* End]()_[@(0.0.255) const]&] -[s2;%% Returns Begin() `+ GetLength().&] +[s5;:Upp`:`:Image`:`:end`(`)const: [@(0.0.255) const]_[_^Upp`:`:RGBA^ RGBA]_`*[* end]()_[@(0.0.255) c +onst]&] +[s2;%% Returns begin() `+ GetLength().&] [s3; &] [s4; &] [s5;:Image`:`:GetSerialId`(`)const: [_^int64^ int64]_GetSerialId()[@(64) _][@(0.0.255) cons