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

Side by Side Diff: cc/paint/skia_paint_canvas.cc

Issue 2904143002: color: Perform color transform in ImageBufferSurface (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "cc/paint/skia_paint_canvas.h" 5 #include "cc/paint/skia_paint_canvas.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/paint/display_item_list.h" 8 #include "cc/paint/display_item_list.h"
9 #include "cc/paint/paint_recorder.h" 9 #include "cc/paint/paint_recorder.h"
10 #include "third_party/skia/include/core/SkAnnotation.h" 10 #include "third_party/skia/include/core/SkAnnotation.h"
11 #include "third_party/skia/include/core/SkColorSpaceXformCanvas.h"
11 #include "third_party/skia/include/core/SkMetaData.h" 12 #include "third_party/skia/include/core/SkMetaData.h"
12 #include "third_party/skia/include/utils/SkNWayCanvas.h" 13 #include "third_party/skia/include/utils/SkNWayCanvas.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {} 17 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas) : canvas_(canvas) {}
17 18
18 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap) 19 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap)
19 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {} 20 : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {}
20 21
21 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap, 22 SkiaPaintCanvas::SkiaPaintCanvas(const SkBitmap& bitmap,
22 const SkSurfaceProps& props) 23 const SkSurfaceProps& props)
23 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {} 24 : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {}
24 25
26 SkiaPaintCanvas::SkiaPaintCanvas(SkCanvas* canvas,
27 sk_sp<SkColorSpace> target_color_space)
28 : canvas_(canvas) {
29 WrapCanvasInColorSpaceXformCanvas(target_color_space);
30 }
31
25 SkiaPaintCanvas::~SkiaPaintCanvas() = default; 32 SkiaPaintCanvas::~SkiaPaintCanvas() = default;
26 33
34 void SkiaPaintCanvas::WrapCanvasInColorSpaceXformCanvas(
35 sk_sp<SkColorSpace> target_color_space) {
36 if (target_color_space) {
37 color_space_xform_canvas_ =
38 SkCreateColorSpaceXformCanvas(canvas_, target_color_space);
39 canvas_ = color_space_xform_canvas_.get();
40 }
41 }
42
27 SkMetaData& SkiaPaintCanvas::getMetaData() { 43 SkMetaData& SkiaPaintCanvas::getMetaData() {
28 return canvas_->getMetaData(); 44 return canvas_->getMetaData();
29 } 45 }
30 46
31 SkImageInfo SkiaPaintCanvas::imageInfo() const { 47 SkImageInfo SkiaPaintCanvas::imageInfo() const {
32 return canvas_->imageInfo(); 48 return canvas_->imageInfo();
33 } 49 }
34 50
35 void SkiaPaintCanvas::flush() { 51 void SkiaPaintCanvas::flush() {
36 canvas_->flush(); 52 canvas_->flush();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 break; 281 break;
266 case AnnotationType::NAMED_DESTINATION: { 282 case AnnotationType::NAMED_DESTINATION: {
267 SkPoint point = SkPoint::Make(rect.x(), rect.y()); 283 SkPoint point = SkPoint::Make(rect.x(), rect.y());
268 SkAnnotateNamedDestination(canvas_, point, data.get()); 284 SkAnnotateNamedDestination(canvas_, point, data.get());
269 break; 285 break;
270 } 286 }
271 } 287 }
272 } 288 }
273 289
274 } // namespace cc 290 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698