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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp

Issue 2825183002: Plumb CanvasColorParams to canvas image classes (Closed)
Patch Set: Require both runtime flags Created 3 years, 8 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 #include "platform/graphics/skia/SkiaUtils.h" 33 #include "platform/graphics/skia/SkiaUtils.h"
34 #include "platform/wtf/PassRefPtr.h" 34 #include "platform/wtf/PassRefPtr.h"
35 #include "third_party/skia/include/core/SkSurface.h" 35 #include "third_party/skia/include/core/SkSurface.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface( 39 UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface(
40 const IntSize& size, 40 const IntSize& size,
41 OpacityMode opacity_mode, 41 OpacityMode opacity_mode,
42 ImageInitializationMode initialization_mode, 42 ImageInitializationMode initialization_mode,
43 sk_sp<SkColorSpace> color_space, 43 const CanvasColorParams& color_params)
44 SkColorType color_type) 44 : ImageBufferSurface(size, opacity_mode, color_params) {
45 : ImageBufferSurface(size, opacity_mode, color_space, color_type) {
46 SkAlphaType alpha_type = 45 SkAlphaType alpha_type =
47 (kOpaque == opacity_mode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; 46 (kOpaque == opacity_mode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
48 SkImageInfo info = SkImageInfo::Make(size.Width(), size.Height(), color_type, 47 SkImageInfo info = SkImageInfo::Make(
49 alpha_type, color_space); 48 size.Width(), size.Height(), color_params.GetSkColorType(), alpha_type,
49 color_params.GetSkColorSpaceForSkSurfaces());
50 SkSurfaceProps disable_lcd_props(0, kUnknown_SkPixelGeometry); 50 SkSurfaceProps disable_lcd_props(0, kUnknown_SkPixelGeometry);
51 surface_ = SkSurface::MakeRaster( 51 surface_ = SkSurface::MakeRaster(
52 info, kOpaque == opacity_mode ? 0 : &disable_lcd_props); 52 info, kOpaque == opacity_mode ? 0 : &disable_lcd_props);
53 53
54 if (!surface_) 54 if (!surface_)
55 return; 55 return;
56 56
57 // Always save an initial frame, to support resetting the top level matrix 57 // Always save an initial frame, to support resetting the top level matrix
58 // and clip. 58 // and clip.
59 canvas_ = WTF::WrapUnique(new SkiaPaintCanvas(surface_->getCanvas())); 59 canvas_ = WTF::WrapUnique(new SkiaPaintCanvas(surface_->getCanvas()));
(...skipping 13 matching lines...) Expand all
73 return surface_; 73 return surface_;
74 } 74 }
75 75
76 sk_sp<SkImage> UnacceleratedImageBufferSurface::NewImageSnapshot( 76 sk_sp<SkImage> UnacceleratedImageBufferSurface::NewImageSnapshot(
77 AccelerationHint, 77 AccelerationHint,
78 SnapshotReason) { 78 SnapshotReason) {
79 return surface_->makeImageSnapshot(); 79 return surface_->makeImageSnapshot();
80 } 80 }
81 81
82 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698