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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.h

Issue 2797213002: Fix BaseRenderingContext2D create/put/get-ImageData() for color managed canvas (Closed)
Patch Set: Fixing more interface listings fails 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef BaseRenderingContext2D_h 5 #ifndef BaseRenderingContext2D_h
6 #define BaseRenderingContext2D_h 6 #define BaseRenderingContext2D_h
7 7
8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h" 8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h"
9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h" 9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 const CanvasImageSourceUnion&, 180 const CanvasImageSourceUnion&,
181 const String& repetition_type, 181 const String& repetition_type,
182 ExceptionState&); 182 ExceptionState&);
183 CanvasPattern* createPattern(ScriptState*, 183 CanvasPattern* createPattern(ScriptState*,
184 CanvasImageSource*, 184 CanvasImageSource*,
185 const String& repetition_type, 185 const String& repetition_type,
186 ExceptionState&); 186 ExceptionState&);
187 187
188 ImageData* createImageData(ImageData*, ExceptionState&) const; 188 ImageData* createImageData(ImageData*, ExceptionState&) const;
189 ImageData* createImageData(int width, int height, ExceptionState&) const; 189 ImageData* createImageData(int width, int height, ExceptionState&) const;
190 ImageData* createImageData(unsigned,
191 unsigned,
192 ImageDataColorSettings&,
193 ExceptionState&) const;
194 ImageData* createImageData(ImageDataArray&,
195 unsigned,
196 unsigned,
197 ImageDataColorSettings&,
198 ExceptionState&) const;
199
190 ImageData* getImageData(int sx, int sy, int sw, int sh, ExceptionState&); 200 ImageData* getImageData(int sx, int sy, int sw, int sh, ExceptionState&);
191 void putImageData(ImageData*, int dx, int dy, ExceptionState&); 201 void putImageData(ImageData*, int dx, int dy, ExceptionState&);
192 void putImageData(ImageData*, 202 void putImageData(ImageData*,
193 int dx, 203 int dx,
194 int dy, 204 int dy,
195 int dirty_x, 205 int dirty_x,
196 int dirty_y, 206 int dirty_y,
197 int dirty_width, 207 int dirty_width,
198 int dirty_height, 208 int dirty_height,
199 ExceptionState&); 209 ExceptionState&);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 virtual void ValidateStateStack() const = 0; 241 virtual void ValidateStateStack() const = 0;
232 242
233 virtual bool HasAlpha() const = 0; 243 virtual bool HasAlpha() const = 0;
234 244
235 virtual bool isContextLost() const = 0; 245 virtual bool isContextLost() const = 0;
236 246
237 virtual ColorBehavior DrawImageColorBehavior() const = 0; 247 virtual ColorBehavior DrawImageColorBehavior() const = 0;
238 248
239 virtual void WillDrawImage(CanvasImageSource*) const {} 249 virtual void WillDrawImage(CanvasImageSource*) const {}
240 250
251 virtual CanvasColorSpace ColorSpace() const {
252 return kLegacyCanvasColorSpace;
253 };
254 virtual String ColorSpaceAsString() const {
255 return kLegacyCanvasColorSpaceName;
256 }
257 virtual CanvasPixelFormat PixelFormat() const {
258 return kRGBA8CanvasPixelFormat;
259 }
260
241 void RestoreMatrixClipStack(PaintCanvas*) const; 261 void RestoreMatrixClipStack(PaintCanvas*) const;
242 262
243 DECLARE_VIRTUAL_TRACE(); 263 DECLARE_VIRTUAL_TRACE();
244 264
245 enum DrawCallType { 265 enum DrawCallType {
246 kStrokePath = 0, 266 kStrokePath = 0,
247 kFillPath, 267 kFillPath,
248 kDrawVectorImage, 268 kDrawVectorImage,
249 kDrawBitmapImage, 269 kDrawBitmapImage,
250 kFillText, 270 kFillText,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 static bool IsFullCanvasCompositeMode(SkBlendMode); 385 static bool IsFullCanvasCompositeMode(SkBlendMode);
366 386
367 template <typename DrawFunc> 387 template <typename DrawFunc>
368 void CompositedDraw(const DrawFunc&, 388 void CompositedDraw(const DrawFunc&,
369 PaintCanvas*, 389 PaintCanvas*,
370 CanvasRenderingContext2DState::PaintType, 390 CanvasRenderingContext2DState::PaintType,
371 CanvasRenderingContext2DState::ImageType); 391 CanvasRenderingContext2DState::ImageType);
372 392
373 void ClearCanvas(); 393 void ClearCanvas();
374 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const; 394 bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const;
395
396 ImageDataColorSettings GetColorSettingsAsImageDataColorSettings() const;
397
398 bool color_management_enabled_;
375 }; 399 };
376 400
377 template <typename DrawFunc, typename ContainsFunc> 401 template <typename DrawFunc, typename ContainsFunc>
378 bool BaseRenderingContext2D::Draw( 402 bool BaseRenderingContext2D::Draw(
379 const DrawFunc& draw_func, 403 const DrawFunc& draw_func,
380 const ContainsFunc& draw_covers_clip_bounds, 404 const ContainsFunc& draw_covers_clip_bounds,
381 const SkRect& bounds, 405 const SkRect& bounds,
382 CanvasRenderingContext2DState::PaintType paint_type, 406 CanvasRenderingContext2DState::PaintType paint_type,
383 CanvasRenderingContext2DState::ImageType image_type) { 407 CanvasRenderingContext2DState::ImageType image_type) {
384 if (!GetState().IsTransformInvertible()) 408 if (!GetState().IsTransformInvertible())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 foreground_flags.setBlendMode(SkBlendMode::kSrcOver); 488 foreground_flags.setBlendMode(SkBlendMode::kSrcOver);
465 c->setMatrix(ctm); 489 c->setMatrix(ctm);
466 draw_func(c, &foreground_flags); 490 draw_func(c, &foreground_flags);
467 c->restore(); 491 c->restore();
468 c->setMatrix(ctm); 492 c->setMatrix(ctm);
469 } 493 }
470 494
471 } // namespace blink 495 } // namespace blink
472 496
473 #endif // BaseRenderingContext2D_h 497 #endif // BaseRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698