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

Side by Side Diff: skia/ext/platform_canvas.cc

Issue 10915065: Add PlatformPictureSkia and RecordingPlatformDeviceSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style changes and move skia include to .cpp file. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/platform_canvas.h" 5 #include "skia/ext/platform_canvas.h"
6 6
7 #include "skia/ext/bitmap_platform_device.h" 7 #include "skia/ext/bitmap_platform_device.h"
8 #include "third_party/skia/include/core/SkTypes.h" 8 #include "third_party/skia/include/core/SkTypes.h"
9 9
10 namespace skia { 10 namespace skia {
(...skipping 30 matching lines...) Expand all
41 canvas = NULL; 41 canvas = NULL;
42 } 42 }
43 return canvas; 43 return canvas;
44 } 44 }
45 45
46 SkDevice* GetTopDevice(const SkCanvas& canvas) { 46 SkDevice* GetTopDevice(const SkCanvas& canvas) {
47 return canvas.getTopDevice(true); 47 return canvas.getTopDevice(true);
48 } 48 }
49 49
50 bool SupportsPlatformPaint(const SkCanvas* canvas) { 50 bool SupportsPlatformPaint(const SkCanvas* canvas) {
51 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
52 return platform_device && platform_device->IsNativeRenderingAllowed();
53 }
54
55 bool SupportsDirectPlatformPaint(const SkCanvas* canvas) {
51 // TODO(alokp): Rename IsNativeFontRenderingAllowed after removing these 56 // TODO(alokp): Rename IsNativeFontRenderingAllowed after removing these
52 // calls from WebKit. 57 // calls from WebKit.
53 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 58 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
54 return platform_device && platform_device->IsNativeFontRenderingAllowed(); 59 return platform_device && platform_device->IsNativeFontRenderingAllowed();
55 } 60 }
56 61
57 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) { 62 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
58 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 63 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
59 if (platform_device) 64 if (platform_device)
60 return platform_device->BeginPlatformPaint(); 65 return platform_device->BeginPlatformPaint();
(...skipping 27 matching lines...) Expand all
88 SkIntToScalar(width), SkIntToScalar(height)); 93 SkIntToScalar(width), SkIntToScalar(height));
89 SkPaint paint; 94 SkPaint paint;
90 // so we don't draw anything on a device that ignores xfermodes 95 // so we don't draw anything on a device that ignores xfermodes
91 paint.setColor(0); 96 paint.setColor(0);
92 // install our custom mode 97 // install our custom mode
93 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref(); 98 paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref();
94 canvas->drawRect(rect, paint); 99 canvas->drawRect(rect, paint);
95 } 100 }
96 101
97 } // namespace skia 102 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698