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 22796028: Updating Chromium to Skia SkBaseDevice/SkBitmapDevice split (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs Created 7 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
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
11 11
12 SkDevice* GetTopDevice(const SkCanvas& canvas) { 12 SkBaseDevice* GetTopDevice(const SkCanvas& canvas) {
13 return canvas.getTopDevice(true); 13 return canvas.getTopDevice(true);
14 } 14 }
15 15
16 bool SupportsPlatformPaint(const SkCanvas* canvas) { 16 bool SupportsPlatformPaint(const SkCanvas* canvas) {
17 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 17 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
18 return platform_device && platform_device->SupportsPlatformPaint(); 18 return platform_device && platform_device->SupportsPlatformPaint();
19 } 19 }
20 20
21 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) { 21 PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
22 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 22 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 skia::RefPtr<SkProcXfermode> xfermode = 57 skia::RefPtr<SkProcXfermode> xfermode =
58 skia::AdoptRef(new SkProcXfermode(MakeOpaqueXfermodeProc)); 58 skia::AdoptRef(new SkProcXfermode(MakeOpaqueXfermodeProc));
59 paint.setXfermode(xfermode.get()); 59 paint.setXfermode(xfermode.get());
60 canvas->drawRect(rect, paint); 60 canvas->drawRect(rect, paint);
61 } 61 }
62 62
63 size_t PlatformCanvasStrideForWidth(unsigned width) { 63 size_t PlatformCanvasStrideForWidth(unsigned width) {
64 return 4 * width; 64 return 4 * width;
65 } 65 }
66 66
67 SkCanvas* CreateCanvas(const skia::RefPtr<SkDevice>& device, OnFailureType failu reType) { 67 SkCanvas* CreateCanvas(const skia::RefPtr<SkBaseDevice>& device, OnFailureType f ailureType) {
68 if (!device) { 68 if (!device) {
69 if (CRASH_ON_FAILURE == failureType) 69 if (CRASH_ON_FAILURE == failureType)
70 SK_CRASH(); 70 SK_CRASH();
71 return NULL; 71 return NULL;
72 } 72 }
73 return new SkCanvas(device.get()); 73 return new SkCanvas(device.get());
74 } 74 }
75 75
76 PlatformBitmap::PlatformBitmap() : surface_(0), platform_extra_(0) {} 76 PlatformBitmap::PlatformBitmap() : surface_(0), platform_extra_(0) {}
77 77
78 } // namespace skia 78 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698