Commit dbce762a authored by reed@google.com's avatar reed@google.com

remove SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR now that call-sites have been updated

BUG=

Review URL: https://codereview.chromium.org/115503003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242150 0039d316-1c4b-4281-b951-d872f2087c98
parent 384cc3ad
...@@ -20,7 +20,8 @@ namespace { ...@@ -20,7 +20,8 @@ namespace {
// HBITMAP. // HBITMAP.
class SK_API PlatformBitmapPixelRef : public SkPixelRef { class SK_API PlatformBitmapPixelRef : public SkPixelRef {
public: public:
PlatformBitmapPixelRef(HBITMAP bitmap_handle, void* pixels); PlatformBitmapPixelRef(const SkImageInfo& info, HBITMAP bitmap_handle,
void* pixels);
virtual ~PlatformBitmapPixelRef(); virtual ~PlatformBitmapPixelRef();
SK_DECLARE_UNFLATTENABLE_OBJECT(); SK_DECLARE_UNFLATTENABLE_OBJECT();
...@@ -117,9 +118,11 @@ HBITMAP CreateHBitmap(int width, int height, bool is_opaque, ...@@ -117,9 +118,11 @@ HBITMAP CreateHBitmap(int width, int height, bool is_opaque,
return hbitmap; return hbitmap;
} }
PlatformBitmapPixelRef::PlatformBitmapPixelRef(HBITMAP bitmap_handle, PlatformBitmapPixelRef::PlatformBitmapPixelRef(const SkImageInfo& info,
HBITMAP bitmap_handle,
void* pixels) void* pixels)
: bitmap_handle_(bitmap_handle), : SkPixelRef(info),
bitmap_handle_(bitmap_handle),
pixels_(pixels) { pixels_(pixels) {
setPreLocked(pixels, NULL); setPreLocked(pixels, NULL);
} }
...@@ -202,10 +205,16 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create( ...@@ -202,10 +205,16 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(
if (!hbitmap) if (!hbitmap)
return NULL; return NULL;
const SkImageInfo info = {
width,
height,
kPMColor_SkColorType,
is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType
};
SkBitmap bitmap; SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0, bitmap.setConfig(info);
is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(info,
RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(hbitmap, hbitmap,
data)); data));
bitmap.setPixelRef(pixel_ref.get()); bitmap.setPixelRef(pixel_ref.get());
...@@ -389,10 +398,16 @@ bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { ...@@ -389,10 +398,16 @@ bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) {
HGDIOBJ stock_bitmap = SelectObject(surface_, hbitmap); HGDIOBJ stock_bitmap = SelectObject(surface_, hbitmap);
platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap); platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap);
bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0, const SkImageInfo info = {
is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); width,
height,
kPMColor_SkColorType,
is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType
};
bitmap_.setConfig(info);
// PlatformBitmapPixelRef takes ownership of |hbitmap|. // PlatformBitmapPixelRef takes ownership of |hbitmap|.
RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(hbitmap, RefPtr<SkPixelRef> pixel_ref = AdoptRef(new PlatformBitmapPixelRef(info,
hbitmap,
data)); data));
bitmap_.setPixelRef(pixel_ref.get()); bitmap_.setPixelRef(pixel_ref.get());
bitmap_.lockPixels(); bitmap_.lockPixels();
......
...@@ -24,24 +24,9 @@ namespace { ...@@ -24,24 +24,9 @@ namespace {
void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap);
class TestPixelRef : public SkPixelRef {
public:
TestPixelRef(int width, int height);
virtual ~TestPixelRef();
virtual SkFlattenable::Factory getFactory() const OVERRIDE;
virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE;
virtual void onUnlockPixels() OVERRIDE {}
virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset)
OVERRIDE;
private:
scoped_ptr<char[]> pixels_;
};
class TestLazyPixelRef : public skia::LazyPixelRef { class TestLazyPixelRef : public skia::LazyPixelRef {
public: public:
TestLazyPixelRef(int width, int height); TestLazyPixelRef(const SkImageInfo& info);
virtual ~TestLazyPixelRef(); virtual ~TestLazyPixelRef();
virtual SkFlattenable::Factory getFactory() const OVERRIDE; virtual SkFlattenable::Factory getFactory() const OVERRIDE;
...@@ -89,25 +74,9 @@ class TestLazyShader : public SkShader { ...@@ -89,25 +74,9 @@ class TestLazyShader : public SkShader {
SkBitmap bitmap_; SkBitmap bitmap_;
}; };
TestPixelRef::TestPixelRef(int width, int height) TestLazyPixelRef::TestLazyPixelRef(const SkImageInfo& info)
: pixels_(new char[4 * width * height]) {} : skia::LazyPixelRef(info),
pixels_(new char[4 * info.fWidth * info.fHeight]) {}
TestPixelRef::~TestPixelRef() {}
SkFlattenable::Factory TestPixelRef::getFactory() const { return NULL; }
void* TestPixelRef::onLockPixels(SkColorTable** color_table) {
return pixels_.get();
}
SkPixelRef* TestPixelRef::deepCopy(SkBitmap::Config config,
const SkIRect* subset) {
this->ref();
return this;
}
TestLazyPixelRef::TestLazyPixelRef(int width, int height)
: pixels_(new char[4 * width * height]) {}
TestLazyPixelRef::~TestLazyPixelRef() {} TestLazyPixelRef::~TestLazyPixelRef() {}
...@@ -132,11 +101,15 @@ SkPixelRef* TestLazyPixelRef::deepCopy(SkBitmap::Config config, ...@@ -132,11 +101,15 @@ SkPixelRef* TestLazyPixelRef::deepCopy(SkBitmap::Config config,
} }
void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
const SkImageInfo info = {
size.width(), size.height(), kPMColor_SkColorType, kPremul_SkAlphaType
};
skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref = skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref =
skia::AdoptRef(new TestLazyPixelRef(size.width(), size.height())); skia::AdoptRef(new TestLazyPixelRef(info));
lazy_pixel_ref->setURI(uri); lazy_pixel_ref->setURI(uri);
bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); bitmap->setConfig(info);
bitmap->setPixelRef(lazy_pixel_ref.get()); bitmap->setPixelRef(lazy_pixel_ref.get());
} }
......
...@@ -145,7 +145,6 @@ ...@@ -145,7 +145,6 @@
'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1', 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
'SK_SUPPORT_LEGACY_COLORTYPE=1', 'SK_SUPPORT_LEGACY_COLORTYPE=1',
'GR_GL_IGNORE_ES3_MSAA=0', 'GR_GL_IGNORE_ES3_MSAA=0',
'SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR=1',
'SK_SUPPORT_DEPRECATED_SCALARROUND', 'SK_SUPPORT_DEPRECATED_SCALARROUND',
'SK_IGNORE_64BIT_OPENGL_CHANGES=1' 'SK_IGNORE_64BIT_OPENGL_CHANGES=1'
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment