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

Issue 406673003: Add the method isOpaque() to SkImage (Closed)

Created:
6 years, 5 months ago by Rémi Piotaix
Modified:
6 years, 4 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 3

Patch Set 2 : Change isOpaque() to info() #

Patch Set 3 : Revert patch 2: back to isOpaque() #

Total comments: 2

Patch Set 4 : Corrections according to comments #

Patch Set 5 : Test for SkImage::isOpaque() (raster + Gpu) #

Patch Set 6 : Rebase master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -0 lines) Patch
M gyp/tests.gypi View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkImage.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M src/image/SkImage_Codec.cpp View 1 2 3 4 5 2 chunks +7 lines, -0 lines 0 comments Download
M src/image/SkImage_Gpu.cpp View 1 2 3 4 5 2 chunks +7 lines, -0 lines 0 comments Download
M src/image/SkImage_Raster.cpp View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
A tests/ImageIsOpaqueTest.cpp View 1 2 3 4 1 chunk +54 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (0 generated)
Rémi Piotaix
PTAL
6 years, 5 months ago (2014-07-18 20:25:08 UTC) #1
Rémi Piotaix
PTAL :-D
6 years, 5 months ago (2014-07-18 20:34:50 UTC) #2
reed1
I like the idea, but there may be performance (or correctness) implications for the codec ...
6 years, 5 months ago (2014-07-18 20:50:02 UTC) #3
Rémi Piotaix
Proposition: expose SkBitmap::info() instead of isOpaque(). This can be even more useful. (We can also ...
6 years, 5 months ago (2014-07-18 21:12:51 UTC) #4
scroggo
https://codereview.chromium.org/406673003/diff/1/src/image/SkImage_Codec.cpp File src/image/SkImage_Codec.cpp (right): https://codereview.chromium.org/406673003/diff/1/src/image/SkImage_Codec.cpp#newcode82 src/image/SkImage_Codec.cpp:82: return SkImage::isOpaque(); On 2014/07/18 21:12:50, Rémi Piotaix wrote: > ...
6 years, 5 months ago (2014-07-18 21:39:14 UTC) #5
Rémi Piotaix
And what about exposing SkBitmap::info() instead of isOpaque() ? This way, we can get more ...
6 years, 5 months ago (2014-07-22 19:12:35 UTC) #6
scroggo
On 2014/07/22 19:12:35, Rémi Piotaix wrote: > And what about exposing SkBitmap::info() instead of isOpaque() ...
6 years, 5 months ago (2014-07-22 19:29:42 UTC) #7
hal.canary
On 2014/07/22 19:29:42, scroggo wrote: > That seems like a good idea to me - ...
6 years, 5 months ago (2014-07-22 19:33:30 UTC) #8
Rémi Piotaix
On 2014/07/22 19:33:30, Hal Canary wrote: > On 2014/07/22 19:29:42, scroggo wrote: > > That ...
6 years, 4 months ago (2014-08-01 18:13:52 UTC) #9
reed1
Certainly we began wanting to keep SkImage abstract enough that it could contain pictures or ...
6 years, 4 months ago (2014-08-05 13:52:15 UTC) #10
Justin Novosad
On 2014/08/05 13:52:15, reed1 wrote: > Certainly we began wanting to keep SkImage abstract enough ...
6 years, 4 months ago (2014-08-05 15:39:23 UTC) #11
Rémi Piotaix
Patch 2 reverted: back to isOpaque().
6 years, 4 months ago (2014-08-06 18:19:09 UTC) #12
reed1
Hmmm, the Codec case is interesting, in that we can return different answers depending on ...
6 years, 4 months ago (2014-08-06 19:45:03 UTC) #13
Rémi Piotaix
https://codereview.chromium.org/406673003/diff/40001/src/image/SkImage_Codec.cpp File src/image/SkImage_Codec.cpp (right): https://codereview.chromium.org/406673003/diff/40001/src/image/SkImage_Codec.cpp#newcode81 src/image/SkImage_Codec.cpp:81: if (!fBitmap.pixelRef()) { On 2014/08/06 19:45:02, reed1 wrote: > ...
6 years, 4 months ago (2014-08-08 14:49:15 UTC) #14
reed1
Hal is going to update the codec image code to correctly (lazily) compute its alphatype ...
6 years, 4 months ago (2014-08-08 18:26:38 UTC) #15
Rémi Piotaix
On 2014/08/08 18:26:38, reed1 wrote: > Hal is going to update the codec image code ...
6 years, 4 months ago (2014-08-11 23:30:31 UTC) #16
reed1
raster parts look fine. brian, does the gpu part of the test look correct / ...
6 years, 4 months ago (2014-08-12 13:50:02 UTC) #17
bsalomon
On 2014/08/12 13:50:02, reed1 wrote: > raster parts look fine. brian, does the gpu part ...
6 years, 4 months ago (2014-08-12 15:16:05 UTC) #18
Rémi Piotaix
On 2014/08/12 15:16:05, bsalomon wrote: > On 2014/08/12 13:50:02, reed1 wrote: > > raster parts ...
6 years, 4 months ago (2014-08-12 15:17:59 UTC) #19
Rémi Piotaix
Ping ?
6 years, 4 months ago (2014-08-19 20:58:16 UTC) #20
reed1
The CQ bit was checked by reed@google.com
6 years, 4 months ago (2014-08-19 21:21:04 UTC) #21
reed1
lgtm
6 years, 4 months ago (2014-08-19 21:21:05 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/piotaixr@chromium.org/406673003/100001
6 years, 4 months ago (2014-08-19 21:21:47 UTC) #23
commit-bot: I haz the power
Committed patchset #6 (100001) as d2a3522503ca0c39829f1bb41f01201d1affdaf6
6 years, 4 months ago (2014-08-19 21:29:15 UTC) #24
caryclark
6 years, 4 months ago (2014-08-20 12:54:01 UTC) #25
Message was sent while issue was closed.
A revert of this CL (patchset #6) has been created in
https://codereview.chromium.org/488093002/ by caryclark@google.com.

The reason for reverting is: This breaks the ValGrind build
http://108.170.220.120:10115/builders/Test-Ubuntu12-ShuttleA-GTX550Ti-x86_64-...

which exposes this leak

[01:02:44.642455] ==12875== 
[01:02:44.642530] ==12875== HEAP SUMMARY:
[01:02:45.643727] ==12875==     in use at exit: 140,008,712 bytes in 13,313
blocks
[01:02:45.643846] ==12875==   total heap usage: 38,479,491 allocs, 38,466,178
frees, 827,882,997,105 bytes allocated
[01:02:45.643903] ==12875== 
[01:02:45.643951] ==12875== 340 (88 direct, 252 indirect) bytes in 1 blocks are
definitely lost in loss record 788 of 2,001
[01:02:45.643999] ==12875==    at 0x4C2B1C7: operator new(unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
[01:02:45.644066] ==12875==    by 0x637CCF: SkNewImageFromPixelRef(SkImageInfo
const&, SkPixelRef*, unsigned long) (SkImage_Raster.cpp:218)
[01:02:45.644120] ==12875==    by 0x6373B6: SkNewImageFromBitmap(SkBitmap
const&, bool) (SkImagePriv.cpp:20)
[01:02:45.644167] ==12875==    by 0x638132:
SkSurface_Raster::onNewImageSnapshot() (SkSurface_Raster.cpp:116)
[01:02:45.644213] ==12875==    by 0x637EEE: SkSurface::newImageSnapshot()
(SkSurface_Base.h:91)
[01:02:45.644272] ==12875==    by 0x4B1AFC:
skiatest::ImageIsOpaqueTestClass::onRun(skiatest::Reporter*)
(ImageIsOpaqueTest.cpp:20)
[01:02:45.644319] ==12875==    by 0x4184E0: skiatest::Test::run() (Test.cpp:107)
[01:02:45.644364] ==12875==    by 0x40CD3F: DM::CpuTestTask::draw()
(DMTestTask.cpp:42)
[01:02:45.644422] ==12875==    by 0x40C217: DM::CpuTask::run() (DMTask.cpp:51)
[01:02:45.644467] ==12875==    by 0x40AEF4: SkTThreadPool<void>::Loop(void*)
(SkThreadPool.h:116)
[01:02:45.644514] ==12875==    by 0x73C87A: thread_start(void*)
(SkThreadUtils_pthread.cpp:66)
[01:02:45.644559] ==12875==    by 0x5693E99: start_thread (pthread_create.c:308)
[01:02:45.644605] ==12875==    by 0x6D3FCBC: clone (clone.S:112)
[01:02:45.644651] ==12875== 
[01:02:45.644695] {
[01:02:45.644739]    <insert_a_suppression_name_here>
[01:02:45.644784]    Memcheck:Leak
[01:02:45.644828]    fun:_Znwm
[01:02:45.644874]    fun:_Z22SkNewImageFromPixelRefRK11SkImageInfoP10SkPixelRefm
[01:02:45.644918]    fun:_Z20SkNewImageFromBitmapRK8SkBitmapb
[01:02:45.644962]    fun:_ZN16SkSurface_Raster18onNewImageSnapshotEv
[01:02:45.645009]    fun:_ZN9SkSurface16newImageSnapshotEv
[01:02:45.645054]   
fun:_ZN8skiatest22ImageIsOpaqueTestClass5onRunEPNS_8ReporterE
[01:02:45.645099]    fun:_ZN8skiatest4Test3runEv
[01:02:45.645144]    fun:_ZN2DM11CpuTestTask4drawEv
[01:02:45.645188]    fun:_ZN2DM7CpuTask3runEv
[01:02:45.645232]    fun:_ZN13SkTThreadPoolIvE4LoopEPv
[01:02:45.645297]    fun:_ZL12thread_startPv
[01:02:45.645345]    fun:start_thread
[01:02:45.645394]    fun:clone
[01:02:45.645439] }
[01:02:45.645498] ==12875== 340 (88 direct, 252 indirect) bytes in 1 blocks are
definitely lost in loss record 789 of 2,001
[01:02:45.645544] ==12875==    at 0x4C2B1C7: operator new(unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
[01:02:45.645590] ==12875==    by 0x637CCF: SkNewImageFromPixelRef(SkImageInfo
const&, SkPixelRef*, unsigned long) (SkImage_Raster.cpp:218)
[01:02:45.645636] ==12875==    by 0x6373B6: SkNewImageFromBitmap(SkBitmap
const&, bool) (SkImagePriv.cpp:20)
[01:02:45.645681] ==12875==    by 0x638132:
SkSurface_Raster::onNewImageSnapshot() (SkSurface_Raster.cpp:116)
[01:02:45.645727] ==12875==    by 0x637EEE: SkSurface::newImageSnapshot()
(SkSurface_Base.h:91)
[01:02:45.645771] ==12875==    by 0x4B1B83:
skiatest::ImageIsOpaqueTestClass::onRun(skiatest::Reporter*)
(ImageIsOpaqueTest.cpp:24)
[01:02:45.645829] ==12875==    by 0x4184E0: skiatest::Test::run() (Test.cpp:107)
[01:02:45.645873] ==12875==    by 0x40CD3F: DM::CpuTestTask::draw()
(DMTestTask.cpp:42)
[01:02:45.645927] ==12875==    by 0x40C217: DM::CpuTask::run() (DMTask.cpp:51)
[01:02:45.645972] ==12875==    by 0x40AEF4: SkTThreadPool<void>::Loop(void*)
(SkThreadPool.h:116)
[01:02:45.646026] ==12875==    by 0x73C87A: thread_start(void*)
(SkThreadUtils_pthread.cpp:66)
[01:02:45.646071] ==12875==    by 0x5693E99: start_thread (pthread_create.c:308)
[01:02:45.646124] ==12875==    by 0x6D3FCBC: clone (clone.S:112)
[01:02:45.646169] ==12875== 
[01:02:45.646214] {
[01:02:45.646258]    <insert_a_suppression_name_here>
[01:02:45.646313]    Memcheck:Leak
[01:02:45.646362]    fun:_Znwm
[01:02:45.646407]    fun:_Z22SkNewImageFromPixelRefRK11SkImageInfoP10SkPixelRefm
[01:02:45.646452]    fun:_Z20SkNewImageFromBitmapRK8SkBitmapb
[01:02:45.646498]    fun:_ZN16SkSurface_Raster18onNewImageSnapshotEv
[01:02:45.646544]    fun:_ZN9SkSurface16newImageSnapshotEv
[01:02:45.646589]   
fun:_ZN8skiatest22ImageIsOpaqueTestClass5onRunEPNS_8ReporterE
[01:02:45.646635]    fun:_ZN8skiatest4Test3runEv
[01:02:45.646680]    fun:_ZN2DM11CpuTestTask4drawEv
[01:02:45.646725]    fun:_ZN2DM7CpuTask3runEv
[01:02:45.646770]    fun:_ZN13SkTThreadPoolIvE4LoopEPv
[01:02:45.646815]    fun:_ZL12thread_startPv
[01:02:45.646860]    fun:start_thread
[01:02:45.646904]    fun:clone
[01:02:45.646951] }
[01:02:45.646995] ==12875== 1,168 (176 direct, 992 indirect) bytes in 2 blocks
are definitely lost in loss record 834 of 2,001
[01:02:45.647046] ==12875==    at 0x4C2B1C7: operator new(unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
[01:02:45.647092] ==12875==    by 0x7D975D: SkImage::NewTexture(SkBitmap const&)
(SkImage_Gpu.cpp:89)
[01:02:45.647140] ==12875==    by 0x7C5C3B: SkSurface_Gpu::onNewImageSnapshot()
(SkSurface_Gpu.cpp:66)
[01:02:45.647189] ==12875==    by 0x637EEE: SkSurface::newImageSnapshot()
(SkSurface_Base.h:91)
[01:02:45.647234] ==12875==    by 0x4B1F96:
skiatest::ImageIsOpaqueTest_GPUClass::onRun(skiatest::Reporter*)
(ImageIsOpaqueTest.cpp:45)
[01:02:45.647283] ==12875==    by 0x4184E0: skiatest::Test::run() (Test.cpp:107)
[01:02:45.647328] ==12875==    by 0x40CD09:
DM::GpuTestTask::draw(GrContextFactory*) (DMTestTask.cpp:51)
[01:02:45.647373] ==12875==    by 0x40C27B: DM::GpuTask::run(GrContextFactory&)
(DMTask.cpp:69)
[01:02:45.647420] ==12875==    by 0x40C909:
SkTThreadPool<GrContextFactory>::Loop(void*) (SkThreadPool.h:110)
[01:02:45.647467] ==12875==    by 0x73C87A: thread_start(void*)
(SkThreadUtils_pthread.cpp:66)
[01:02:45.647515] ==12875==    by 0x5693E99: start_thread (pthread_create.c:308)
[01:02:45.647560] ==12875==    by 0x6D3FCBC: clone (clone.S:112)
[01:02:45.647608] ==12875== 
[01:02:45.647654] {
[01:02:45.647700]    <insert_a_suppression_name_here>
[01:02:45.647745]    Memcheck:Leak
[01:02:45.647789]    fun:_Znwm
[01:02:45.647835]    fun:_ZN7SkImage10NewTextureERK8SkBitmap
[01:02:45.647880]    fun:_ZN13SkSurface_Gpu18onNewImageSnapshotEv
[01:02:45.647924]    fun:_ZN9SkSurface16newImageSnapshotEv
[01:02:45.647971]   
fun:_ZN8skiatest26ImageIsOpaqueTest_GPUClass5onRunEPNS_8ReporterE
[01:02:45.648015]    fun:_ZN8skiatest4Test3runEv
[01:02:45.648059]    fun:_ZN2DM11GpuTestTask4drawEP16GrContextFactory
[01:02:45.648108]    fun:_ZN2DM7GpuTask3runER16GrContextFactory
[01:02:45.648154]    fun:_ZN13SkTThreadPoolI16GrContextFactoryE4LoopEPv
[01:02:45.648200]    fun:_ZL12thread_startPv
[01:02:45.648245]    fun:start_thread
[01:02:45.648290]    fun:clone
[01:02:45.648338] }
[01:02:45.648383] ==12875== 1,168 (176 direct, 992 indirect) bytes in 2 blocks
are definitely lost in loss record 835 of 2,001
[01:02:45.648432] ==12875==    at 0x4C2B1C7: operator new(unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
[01:02:45.648478] ==12875==    by 0x7D975D: SkImage::NewTexture(SkBitmap const&)
(SkImage_Gpu.cpp:89)
[01:02:45.648525] ==12875==    by 0x7C5C3B: SkSurface_Gpu::onNewImageSnapshot()
(SkSurface_Gpu.cpp:66)
[01:02:45.648574] ==12875==    by 0x637EEE: SkSurface::newImageSnapshot()
(SkSurface_Base.h:91)
[01:02:45.648620] ==12875==    by 0x4B2030:
skiatest::ImageIsOpaqueTest_GPUClass::onRun(skiatest::Reporter*)
(ImageIsOpaqueTest.cpp:49)
[01:02:45.648668] ==12875==    by 0x4184E0: skiatest::Test::run() (Test.cpp:107)
[01:02:45.648713] ==12875==    by 0x40CD09:
DM::GpuTestTask::draw(GrContextFactory*) (DMTestTask.cpp:51)
[01:02:45.648762] ==12875==    by 0x40C27B: DM::GpuTask::run(GrContextFactory&)
(DMTask.cpp:69)
[01:02:45.648807] ==12875==    by 0x40C909:
SkTThreadPool<GrContextFactory>::Loop(void*) (SkThreadPool.h:110)
[01:02:45.648852] ==12875==    by 0x73C87A: thread_start(void*)
(SkThreadUtils_pthread.cpp:66)
[01:02:45.648900] ==12875==    by 0x5693E99: start_thread (pthread_create.c:308)
[01:02:45.648946] ==12875==    by 0x6D3FCBC: clone (clone.S:112)
[01:02:45.648994] ==12875== 
[01:02:45.649039] {
[01:02:45.649085]    <insert_a_suppression_name_here>
[01:02:45.649130]    Memcheck:Leak
[01:02:45.649174]    fun:_Znwm
[01:02:45.649222]    fun:_ZN7SkImage10NewTextureERK8SkBitmap
[01:02:45.649267]    fun:_ZN13SkSurface_Gpu18onNewImageSnapshotEv
[01:02:45.649322]    fun:_ZN9SkSurface16newImageSnapshotEv
[01:02:45.649367]   
fun:_ZN8skiatest26ImageIsOpaqueTest_GPUClass5onRunEPNS_8ReporterE
[01:02:45.649412]    fun:_ZN8skiatest4Test3runEv
[01:02:45.649460]    fun:_ZN2DM11GpuTestTask4drawEP16GrContextFactory
[01:02:45.649506]    fun:_ZN2DM7GpuTask3runER16GrContextFactory
[01:02:45.649554]    fun:_ZN13SkTThreadPoolI16GrContextFactoryE4LoopEPv
[01:02:45.649599]    fun:_ZL12thread_startPv
[01:02:45.649645]    fun:start_thread
[01:02:45.649690]    fun:clone
[01:02:45.649738] }
[01:02:45.649783] ==12875== LEAK SUMMARY:
[01:02:45.649830] ==12875==    definitely lost: 528 bytes in 6 blocks
[01:02:45.649875] ==12875==    indirectly lost: 2,712 bytes in 23 blocks
[01:02:45.649923] ==12875==      possibly lost: 0 bytes in 0 blocks
[01:02:45.649968] ==12875==    still reachable: 136,805,456 bytes in 12,002
blocks
[01:02:45.650017] ==12875==         suppressed: 3,200,016 bytes in 1,282 blocks
[01:02:45.650062] ==12875== Reachable blocks (those to which a pointer was
found) are not shown.
[01:02:45.650109] ==12875== To see them, rerun with: --leak-check=full
--show-reachable=yes
[01:02:45.650154] ==12875== 
[01:02:45.650199] ==12875== For counts of detected and suppressed errors, rerun
with: -v
[01:02:45.650247] ==12875== ERROR SUMMARY: 4 errors from 4 contexts (suppressed:
44878 from 660)
.

Powered by Google App Engine
This is Rietveld 408576698