diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 20:02:43 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 20:02:43 +0000 |
commit | 8a945ed4f63d751a6dd9a7379d429534dfc8cd47 (patch) | |
tree | acb64fe77c56ca1829f9a9b4e58c150b99072d8e | |
parent | ea24690b8b8492b26f721e7a1fc12cc645438b96 (diff) | |
download | chromium_src-8a945ed4f63d751a6dd9a7379d429534dfc8cd47.zip chromium_src-8a945ed4f63d751a6dd9a7379d429534dfc8cd47.tar.gz chromium_src-8a945ed4f63d751a6dd9a7379d429534dfc8cd47.tar.bz2 |
Always use the SkPixelRef constructor that takes SkImageInfo, as the older form is
DEPRECATED and needs to go away soon (so skia can rely on the info)
BUG=
Review URL: https://codereview.chromium.org/108273004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239832 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/output/gl_renderer.cc | 37 | ||||
-rw-r--r-- | cc/resources/etc1_pixel_ref.cc | 9 | ||||
-rw-r--r-- | cc/resources/etc1_pixel_ref.h | 8 | ||||
-rw-r--r-- | skia/ext/lazy_pixel_ref.cc | 8 | ||||
-rw-r--r-- | skia/ext/lazy_pixel_ref.h | 5 |
5 files changed, 54 insertions, 13 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index b383d9f..054fa3a 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -480,13 +480,17 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( backend_texture_description)); + SkImageInfo info = { + source_texture_resource->size().width(), + source_texture_resource->size().height(), + kPMColor_SkColorType, + kPremul_SkAlphaType + }; // Place the platform texture inside an SkBitmap. SkBitmap source; - source.setConfig(SkBitmap::kARGB_8888_Config, - source_texture_resource->size().width(), - source_texture_resource->size().height()); + source.setConfig(info); skia::RefPtr<SkGrPixelRef> pixel_ref = - skia::AdoptRef(new SkGrPixelRef(texture.get())); + skia::AdoptRef(new SkGrPixelRef(info, texture.get())); source.setPixelRef(pixel_ref.get()); // Create a scratch texture for backing store. @@ -591,20 +595,31 @@ static SkBitmap ApplyBlendModeWithBackdrop( skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( backend_texture_description)); + SkImageInfo source_info = { + source_size.width(), + source_size.height(), + kPMColor_SkColorType, + kPremul_SkAlphaType + }; // Place the platform texture inside an SkBitmap. SkBitmap source; - source.setConfig( - SkBitmap::kARGB_8888_Config, source_size.width(), source_size.height()); + source.setConfig(source_info); skia::RefPtr<SkGrPixelRef> source_pixel_ref = - skia::AdoptRef(new SkGrPixelRef(source_texture.get())); + skia::AdoptRef(new SkGrPixelRef(source_info, source_texture.get())); source.setPixelRef(source_pixel_ref.get()); + SkImageInfo background_info = { + background_size.width(), + background_size.height(), + kPMColor_SkColorType, + kPremul_SkAlphaType + }; + SkBitmap background; - background.setConfig(SkBitmap::kARGB_8888_Config, - background_size.width(), - background_size.height()); + background.setConfig(background_info); skia::RefPtr<SkGrPixelRef> background_pixel_ref = - skia::AdoptRef(new SkGrPixelRef(background_texture.get())); + skia::AdoptRef(new SkGrPixelRef( + background_info, background_texture.get())); background.setPixelRef(background_pixel_ref.get()); // Create a scratch texture for backing store. diff --git a/cc/resources/etc1_pixel_ref.cc b/cc/resources/etc1_pixel_ref.cc index 7a8b8c1..7176562 100644 --- a/cc/resources/etc1_pixel_ref.cc +++ b/cc/resources/etc1_pixel_ref.cc @@ -9,11 +9,20 @@ namespace cc { +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR // Takes ownership of pixels. ETC1PixelRef::ETC1PixelRef(scoped_ptr<uint8_t[]> pixels) : pixels_(pixels.Pass()) { setImmutable(); } +#endif + +// Takes ownership of pixels. +ETC1PixelRef::ETC1PixelRef(const SkImageInfo& info, + scoped_ptr<uint8_t[]> pixels) + : SkPixelRef(info), pixels_(pixels.Pass()) { + setImmutable(); +} ETC1PixelRef::~ETC1PixelRef() {} diff --git a/cc/resources/etc1_pixel_ref.h b/cc/resources/etc1_pixel_ref.h index c64d3a8..166e185 100644 --- a/cc/resources/etc1_pixel_ref.h +++ b/cc/resources/etc1_pixel_ref.h @@ -15,8 +15,14 @@ namespace cc { class CC_EXPORT ETC1PixelRef : public SkPixelRef { public: - // Takes ownership of pixels. +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + // DEPRECATED -- will remove once blink updates to pass info + // TODO(reed) explicit ETC1PixelRef(scoped_ptr<uint8_t[]> pixels); +#endif + + // Takes ownership of pixels. + ETC1PixelRef(const SkImageInfo& info, scoped_ptr<uint8_t[]> pixels); virtual ~ETC1PixelRef(); // SK_DECLARE_UNFLATTENABLE_OBJECT diff --git a/skia/ext/lazy_pixel_ref.cc b/skia/ext/lazy_pixel_ref.cc index 784fae4..ef74089 100644 --- a/skia/ext/lazy_pixel_ref.cc +++ b/skia/ext/lazy_pixel_ref.cc @@ -6,7 +6,13 @@ namespace skia { -LazyPixelRef::LazyPixelRef() : SkPixelRef(0) { +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR +// DEPRECATED -- will remove after blink updates to pass info +LazyPixelRef::LazyPixelRef() { +} +#endif + +LazyPixelRef::LazyPixelRef(const SkImageInfo& info) : SkPixelRef(info) { } LazyPixelRef::~LazyPixelRef() { diff --git a/skia/ext/lazy_pixel_ref.h b/skia/ext/lazy_pixel_ref.h index fff4c38..d25fc71 100644 --- a/skia/ext/lazy_pixel_ref.h +++ b/skia/ext/lazy_pixel_ref.h @@ -14,7 +14,12 @@ namespace skia { // thread. class SK_API LazyPixelRef : public SkPixelRef { public: +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + // DEPRECATED -- will remove once blink updates to pass info LazyPixelRef(); +#endif + + explicit LazyPixelRef(const SkImageInfo& info); virtual ~LazyPixelRef(); struct PrepareParams { |