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

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

Issue 2610003002: Remove skia::SupportsPlatformPaint() (Closed)
Patch Set: rebase Created 3 years, 11 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') | ui/native_theme/native_theme_win.h » ('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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "skia/ext/platform_device.h" 10 #include "skia/ext/platform_device.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes); 51 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes);
52 if (!pixels) { 52 if (!pixels) {
53 result->reset(); 53 result->reset();
54 return false; 54 return false;
55 } 55 }
56 56
57 result->reset(info, pixels, row_bytes); 57 result->reset(info, pixels, row_bytes);
58 return true; 58 return true;
59 } 59 }
60 60
61 bool SupportsPlatformPaint(const SkCanvas* canvas) {
62 return GetPlatformDevice(canvas->getTopDevice(true)) != nullptr;
63 }
64
65 size_t PlatformCanvasStrideForWidth(unsigned width) { 61 size_t PlatformCanvasStrideForWidth(unsigned width) {
66 return 4 * width; 62 return 4 * width;
67 } 63 }
68 64
69 std::unique_ptr<SkCanvas> CreateCanvas(const sk_sp<SkBaseDevice>& device, 65 std::unique_ptr<SkCanvas> CreateCanvas(const sk_sp<SkBaseDevice>& device,
70 OnFailureType failureType) { 66 OnFailureType failureType) {
71 if (!device) { 67 if (!device) {
72 if (CRASH_ON_FAILURE == failureType) 68 if (CRASH_ON_FAILURE == failureType)
73 SK_CRASH(); 69 SK_CRASH();
74 return nullptr; 70 return nullptr;
(...skipping 22 matching lines...) Expand all
97 93
98 // Compensate for drawing to a layer rather than the entire canvas 94 // Compensate for drawing to a layer rather than the entire canvas
99 SkMatrix ctm; 95 SkMatrix ctm;
100 SkIRect clip_bounds; 96 SkIRect clip_bounds;
101 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds); 97 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds);
102 98
103 return platform_device->BeginPlatformPaint(ctm, clip_bounds); 99 return platform_device->BeginPlatformPaint(ctm, clip_bounds);
104 } 100 }
105 101
106 } // namespace skia 102 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | ui/native_theme/native_theme_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698