diff options
author | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 22:11:10 +0000 |
---|---|---|
committer | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 22:11:10 +0000 |
commit | a7d1dbe36a0b12a7cc3d025180bbdce6b8c0f567 (patch) | |
tree | 8fa7094ff44e5fc4a49ad55bed00ac1723a5411f /skia | |
parent | 080440cebdc80def86dd88356e5922946cc11a79 (diff) | |
download | chromium_src-a7d1dbe36a0b12a7cc3d025180bbdce6b8c0f567.zip chromium_src-a7d1dbe36a0b12a7cc3d025180bbdce6b8c0f567.tar.gz chromium_src-a7d1dbe36a0b12a7cc3d025180bbdce6b8c0f567.tar.bz2 |
Remove set of redundant API calls for PlatformDevice instances. These functions were duplicated for both SkCanvas and SkDevice instances.
This CL unifies these calls to only make use of the SkCanvas entries.
This is CL part of a larger goal to remove the PlatformDevice class.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7168022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/canvas_paint_linux.h | 4 | ||||
-rw-r--r-- | skia/ext/platform_canvas.cc | 23 | ||||
-rw-r--r-- | skia/ext/platform_device.cc | 35 | ||||
-rw-r--r-- | skia/ext/platform_device.h | 20 |
4 files changed, 20 insertions, 62 deletions
diff --git a/skia/ext/canvas_paint_linux.h b/skia/ext/canvas_paint_linux.h index 608350f..fca12ca 100644 --- a/skia/ext/canvas_paint_linux.h +++ b/skia/ext/canvas_paint_linux.h @@ -1,5 +1,5 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -92,7 +92,7 @@ class CanvasPaintT : public T { // surface. T::translate(-SkIntToScalar(bounds.x), -SkIntToScalar(bounds.y)); - context_ = BeginPlatformPaint(GetTopDevice(*this)); + context_ = BeginPlatformPaint(this); } cairo_t* context_; diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc index c6fd17e..2a50ede 100644 --- a/skia/ext/platform_canvas.cc +++ b/skia/ext/platform_canvas.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -47,24 +47,35 @@ SkDevice* GetTopDevice(const SkCanvas& canvas) { bool SupportsPlatformPaint(const SkCanvas* canvas) { // TODO(alokp): Rename IsNativeFontRenderingAllowed after removing these // calls from WebKit. - return IsNativeFontRenderingAllowed(GetTopDevice(*canvas)); + PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); + return platform_device && platform_device->IsNativeFontRenderingAllowed(); } PlatformSurface BeginPlatformPaint(SkCanvas* canvas) { - return BeginPlatformPaint(GetTopDevice(*canvas)); + PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); + if (platform_device) + return platform_device->BeginPlatformPaint(); + + return 0; } void EndPlatformPaint(SkCanvas* canvas) { - EndPlatformPaint(GetTopDevice(*canvas)); + PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); + if (platform_device) + platform_device->EndPlatformPaint(); } void DrawToNativeContext(SkCanvas* canvas, PlatformSurface context, int x, int y, const PlatformRect* src_rect) { - DrawToNativeContext(GetTopDevice(*canvas), context, x, y, src_rect); + PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); + if (platform_device) + platform_device->DrawToNativeContext(context, x, y, src_rect); } void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height) { - MakeOpaque(GetTopDevice(*canvas), x, y, width, height); + PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); + if (platform_device) + platform_device->MakeOpaque(x, y, width, height); } } // namespace skia diff --git a/skia/ext/platform_device.cc b/skia/ext/platform_device.cc index a08f525..4bfde0f 100644 --- a/skia/ext/platform_device.cc +++ b/skia/ext/platform_device.cc @@ -27,40 +27,5 @@ PlatformDevice* GetPlatformDevice(SkDevice* device) { return NULL; } -PlatformSurface BeginPlatformPaint(SkDevice* device) { - PlatformDevice* platform_device = GetPlatformDevice(device); - if (platform_device) - return platform_device->BeginPlatformPaint(); - - return 0; -} - -void EndPlatformPaint(SkDevice* device) { - PlatformDevice* platform_device = GetPlatformDevice(device); - if (platform_device) - return platform_device->EndPlatformPaint(); -} - -bool IsNativeFontRenderingAllowed(SkDevice* device) { - PlatformDevice* platform_device = GetPlatformDevice(device); - if (platform_device) - return platform_device->IsNativeFontRenderingAllowed(); - - return false; -} - -void DrawToNativeContext(SkDevice* device, PlatformSurface context, - int x, int y, const PlatformRect* src_rect) { - PlatformDevice* platform_device = GetPlatformDevice(device); - if (platform_device) - platform_device->DrawToNativeContext(context, x, y, src_rect); -} - -void MakeOpaque(SkDevice* device, int x, int y, int width, int height) { - PlatformDevice* platform_device = GetPlatformDevice(device); - if (platform_device) - platform_device->MakeOpaque(x, y, width, height); -} - } // namespace skia diff --git a/skia/ext/platform_device.h b/skia/ext/platform_device.h index d6683788..81e475d 100644 --- a/skia/ext/platform_device.h +++ b/skia/ext/platform_device.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -59,24 +59,6 @@ SK_API void SetPlatformDevice(SkDevice* device, PlatformDevice* platform_device); SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); -// Returns if the native font rendering engine is allowed to render text to -// this device. -SK_API bool IsNativeFontRenderingAllowed(SkDevice* device); - -// Returns the PlatformSurface used for native rendering into the device. -SK_API PlatformSurface BeginPlatformPaint(SkDevice* device); - -// Finish a previous call to BeginPlatformPaint. -SK_API void EndPlatformPaint(SkDevice* device); - -// Draws to the given PlatformSurface, |context|. Forwards to the -// PlatformDevice bound to |device|. Otherwise is a NOP. -SK_API void DrawToNativeContext(SkDevice* device, PlatformSurface context, - int x, int y, const PlatformRect* src_rect); - -// Sets the opacity of each pixel in the specified region to be opaque. -SK_API void MakeOpaque(SkDevice* device, int x, int y, int width, int height); - } // namespace skia #if defined(WIN32) |