Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Issue 1291803002: Extend SkImageGenerator to support natively generated GrTextures (Closed)

Created:
5 years, 4 months ago by reed1
Modified:
5 years, 4 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Extend SkImageGenerator to support natively generated GrTextures. As part of this, added uniqueID() to the generator, and made it be in the same namespace is bitmaps, pixelrefs, images. To do this, create SkImageCacherator, which wraps a generator and provides an interface to get a cached answer for either the raster or texture output of the generator. BUG=skia: Committed: https://skia.googlesource.com/skia/+/8f34372f7e97482e5e61ab298b7edaa008ba2f4c

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 20

Patch Set 5 : #

Total comments: 4

Patch Set 6 : #

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+477 lines, -11 lines) Patch
M gm/image_pict.cpp View 1 2 3 4 5 2 chunks +90 lines, -0 lines 0 comments Download
M gyp/core.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkImageGenerator.h View 1 5 chunks +32 lines, -1 line 0 comments Download
M include/core/SkImageInfo.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M include/core/SkPixelRef.h View 1 chunk +1 line, -0 lines 0 comments Download
M include/gpu/SkGr.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A src/core/SkImageCacherator.h View 1 2 3 4 5 6 1 chunk +51 lines, -0 lines 0 comments Download
A src/core/SkImageCacherator.cpp View 1 2 3 4 1 chunk +144 lines, -0 lines 0 comments Download
M src/core/SkImageGenerator.cpp View 1 2 chunks +13 lines, -0 lines 0 comments Download
M src/core/SkPictureImageGenerator.cpp View 1 3 chunks +29 lines, -1 line 0 comments Download
M src/gpu/SkGr.cpp View 1 2 3 4 5 6 3 chunks +67 lines, -9 lines 0 comments Download
A src/gpu/SkGrPriv.h View 1 1 chunk +32 lines, -0 lines 0 comments Download

Messages

Total messages: 30 (11 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/20001
5 years, 4 months ago (2015-08-13 14:34:06 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/2555) Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on ...
5 years, 4 months ago (2015-08-13 14:35:30 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/40001
5 years, 4 months ago (2015-08-13 14:41:26 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/2558) Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on ...
5 years, 4 months ago (2015-08-13 14:42:59 UTC) #8
reed1
ptal -- the cacherator is private, intended to be used by SkImage-from-generators.
5 years, 4 months ago (2015-08-13 18:28:38 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/60001
5 years, 4 months ago (2015-08-13 18:28:57 UTC) #12
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/2567)
5 years, 4 months ago (2015-08-13 18:35:21 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/80001
5 years, 4 months ago (2015-08-13 19:09:26 UTC) #16
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/2569) Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on ...
5 years, 4 months ago (2015-08-13 19:11:15 UTC) #18
scroggo
> Extend SkImageGenerator to support natively generated GrTextures. As part of this, added uniqueID() to ...
5 years, 4 months ago (2015-08-13 19:59:13 UTC) #19
bsalomon
https://codereview.chromium.org/1291803002/diff/80001/src/core/SkImageCacherator.h File src/core/SkImageCacherator.h (right): https://codereview.chromium.org/1291803002/diff/80001/src/core/SkImageCacherator.h#newcode16 src/core/SkImageCacherator.h:16: class SkImageCacherator { comment about what this is? https://codereview.chromium.org/1291803002/diff/80001/src/gpu/SkGr.cpp ...
5 years, 4 months ago (2015-08-13 20:08:29 UTC) #20
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/100001
5 years, 4 months ago (2015-08-13 20:08:47 UTC) #22
reed1
https://codereview.chromium.org/1291803002/diff/80001/src/core/SkImageCacherator.h File src/core/SkImageCacherator.h (right): https://codereview.chromium.org/1291803002/diff/80001/src/core/SkImageCacherator.h#newcode16 src/core/SkImageCacherator.h:16: class SkImageCacherator { On 2015/08/13 20:08:29, bsalomon wrote: > ...
5 years, 4 months ago (2015-08-13 20:14:37 UTC) #23
reed1
ptal
5 years, 4 months ago (2015-08-13 20:24:43 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1291803002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1291803002/120001
5 years, 4 months ago (2015-08-13 20:25:05 UTC) #26
commit-bot: I haz the power
Note for Reviewers: The CQ is waiting for an approval. If you believe that the ...
5 years, 4 months ago (2015-08-13 20:25:06 UTC) #27
bsalomon
lgtm
5 years, 4 months ago (2015-08-13 20:26:39 UTC) #28
commit-bot: I haz the power
Committed patchset #7 (id:120001) as https://skia.googlesource.com/skia/+/8f34372f7e97482e5e61ab298b7edaa008ba2f4c
5 years, 4 months ago (2015-08-13 20:32:44 UTC) #29
reed1
5 years, 4 months ago (2015-08-13 20:57:08 UTC) #30
Message was sent while issue was closed.
https://codereview.chromium.org/1291803002/diff/60001/include/core/SkImageGen...
File include/core/SkImageGenerator.h (right):

https://codereview.chromium.org/1291803002/diff/60001/include/core/SkImageGen...
include/core/SkImageGenerator.h:61: uint32_t uniqueID() const { return
fUniqueID; }
On 2015/08/13 19:59:12, scroggo wrote:
> If an SkImage or SkBitmap uses this generator, should it share this ID?

It will -- that is handled in my following CL

https://codereview.chromium.org/1291803002/diff/60001/include/core/SkImageGen...
include/core/SkImageGenerator.h:148: *  native size) it may, so the caller must
inspect the texture's width/height
On 2015/08/13 19:59:12, scroggo wrote:
> I lost the thread of this sentence. Maybe it would be clearer to say:
> 
> If the context (...) must return a different sized texture (...) to support
the
> specified usage, it may.
> 
> I do not understand how the remainder of the sentence is related. It's also
not
> clear to me how it relates to the SkImageUsageType (except that kUntiled has
> some special meaning relative to the others).

Done.

https://codereview.chromium.org/1291803002/diff/60001/include/core/SkImageInfo.h
File include/core/SkImageInfo.h (right):

https://codereview.chromium.org/1291803002/diff/60001/include/core/SkImageInf...
include/core/SkImageInfo.h:23: enum SkImageUsageType {
On 2015/08/13 19:59:13, scroggo wrote:
> Maybe this name should incorporate the word "tiling" somehow, since it only
> applies to tiling?
> 
> It also seems like it only relates to drawing via the GPU? Does it belong
here?
> Maybe in some GPU specific file? (I guess you want to still be able to
reference
> it even when SK_SUPPORT_GPU is false?)

It also appears in SkImageGenrerator.h which is public, so I think it has to be
public and not necessarily gpu-specific. I'm fine to change the name later.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
File src/core/SkImageCacherator.cpp (right):

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.cpp:28: delete fGenerator;
On 2015/08/13 19:59:13, scroggo wrote:
> SkDELETE?

Done.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.cpp:31: static bool check_output_bitmap(const
SkBitmap& bitmap, uint32_t expectedID) {
On 2015/08/13 19:59:13, scroggo wrote:
> This always returns true, so maybe it should return void?
> 
> Should this be "validate"?
> 
> Ah, is this just a helper so you can combine the following into one line?
> 
> check_output_bitmap(...);
> return true;

Acknowledged.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.cpp:67: const SkImageInfo& info = this->info();
On 2015/08/13 19:59:13, scroggo wrote:
> Maybe move this down closer to where it's used?

Done.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.cpp:73: // Try to get a texture and read it back to
raster (and then cache that with our ID)
On 2015/08/13 19:59:13, scroggo wrote:
> A read back is potentially expensive, right? Should the header explain that
this
> function might do this expensive operation?

Calling the generator itself can be very expensive. I presume it is implied that
the cacherator will be potentially slow the first time it is accessed, but
faster after that.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
File src/core/SkImageCacherator.h (right):

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.h:19: SkImageCacherator(SkImageGenerator* gen);
On 2015/08/13 19:59:13, scroggo wrote:
> Maybe this should be a factory, so we don't end up getting any calls to
> 
> new SkImageCacherator(nullptr)
> 
> ?

Done.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.h:29: *  The cached bitmap is valid until it goes out
of scope.
On 2015/08/13 19:59:13, scroggo wrote:
> Are you saying the bitmap passed to this function is valid until it goes out
of
> scope, or until the SkImageCacherator goes out of scope? What happens if the
> client passes one on the heap?

Fixed.

https://codereview.chromium.org/1291803002/diff/60001/src/core/SkImageCachera...
src/core/SkImageCacherator.h:35: *  when it is done. Will return NULL on
failure.
On 2015/08/13 19:59:13, scroggo wrote:
> nullptr?

Hmmm, I'm not sure that distinction is important in a comment, but I hadn't
really considered it.

Powered by Google App Engine
This is Rietveld 408576698