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

Side by Side Diff: Source/core/platform/graphics/GraphicsContext.h

Issue 23643003: ImageBuffer-less SVG masking and clipping. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix the Win build. 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 3 * Copyright (C) 2008-2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // The text region is empty until tracking is turned on. 188 // The text region is empty until tracking is turned on.
189 // It is never clerared by the context. 189 // It is never clerared by the context.
190 void setTrackTextRegion(bool track) { m_trackTextRegion = track; } 190 void setTrackTextRegion(bool track) { m_trackTextRegion = track; }
191 const SkRect& textRegion() const { return m_textRegion; } 191 const SkRect& textRegion() const { return m_textRegion; }
192 192
193 bool updatingControlTints() const { return m_updatingControlTints; } 193 bool updatingControlTints() const { return m_updatingControlTints; }
194 void setUpdatingControlTints(bool updatingTints) { m_updatingControlTints = updatingTints; } 194 void setUpdatingControlTints(bool updatingTints) { m_updatingControlTints = updatingTints; }
195 195
196 AnnotationModeFlags annotationMode() const { return m_annotationMode; } 196 AnnotationModeFlags annotationMode() const { return m_annotationMode; }
197 void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode = mode; } 197 void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode = mode; }
198
199 void setColorSpaceConversion(ColorSpace srcColorSpace, ColorSpace dstColorSp ace);
198 // ---------- End state management methods ----------------- 200 // ---------- End state management methods -----------------
199 201
200 // Get the contents of the image buffer 202 // Get the contents of the image buffer
201 bool readPixels(SkBitmap*, int, int, SkCanvas::Config8888 = SkCanvas::kNativ e_Premul_Config8888); 203 bool readPixels(SkBitmap*, int, int, SkCanvas::Config8888 = SkCanvas::kNativ e_Premul_Config8888);
202 204
203 // Sets up the paint for the current fill style. 205 // Sets up the paint for the current fill style.
204 void setupPaintForFilling(SkPaint*) const; 206 void setupPaintForFilling(SkPaint*) const;
205 207
206 // Sets up the paint for stroking. Returns a float representing the 208 // Sets up the paint for stroking. Returns a float representing the
207 // effective width of the pen. If a non-zero length is provided, the 209 // effective width of the pen. If a non-zero length is provided, the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY, const SkRect& textRect, const SkPaint&); 273 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY, const SkRect& textRect, const SkPaint&);
272 void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, cons t SkRect& textRect, const SkMatrix*, const SkPaint&); 274 void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, cons t SkRect& textRect, const SkMatrix*, const SkPaint&);
273 275
274 void clip(const IntRect& rect) { clip(FloatRect(rect)); } 276 void clip(const IntRect& rect) { clip(FloatRect(rect)); }
275 void clip(const FloatRect& rect) { clipRect(rect); } 277 void clip(const FloatRect& rect) { clipRect(rect); }
276 void clipRoundedRect(const RoundedRect&); 278 void clipRoundedRect(const RoundedRect&);
277 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); } 279 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); }
278 void clipOutRoundedRect(const RoundedRect&); 280 void clipOutRoundedRect(const RoundedRect&);
279 void clipPath(const Path&, WindRule = RULE_EVENODD); 281 void clipPath(const Path&, WindRule = RULE_EVENODD);
280 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); 282 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
281 void clipToImageBuffer(const ImageBuffer*, const FloatRect&);
282 bool clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op); 283 bool clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op);
283 284
284 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); 285 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&);
285 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr ing& mark, const FloatPoint&); 286 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr ing& mark, const FloatPoint&);
286 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); 287 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady);
287 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in t h, const Color& backgroundColor, int from = 0, int to = -1); 288 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in t h, const Color& backgroundColor, int from = 0, int to = -1);
288 289
289 void drawLineForText(const FloatPoint&, float width, bool printing); 290 void drawLineForText(const FloatPoint&, float width, bool printing);
290 enum DocumentMarkerLineStyle { 291 enum DocumentMarkerLineStyle {
291 DocumentMarkerSpellingLineStyle, 292 DocumentMarkerSpellingLineStyle,
292 DocumentMarkerGrammarLineStyle 293 DocumentMarkerGrammarLineStyle
293 }; 294 };
294 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke rLineStyle); 295 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke rLineStyle);
295 296
296 void beginTransparencyLayer(float opacity); 297 void beginTransparencyLayer(float opacity, const FloatRect* = 0);
297 void endTransparencyLayer(); 298 void beginMaskedLayer(const FloatRect&, MaskType = AlphaMaskType);
299 void endLayer();
298 300
299 bool hasShadow() const; 301 bool hasShadow() const;
300 void setShadow(const FloatSize& offset, float blur, const Color&, 302 void setShadow(const FloatSize& offset, float blur, const Color&,
301 DrawLooper::ShadowTransformMode = DrawLooper::ShadowRespectsTransforms, 303 DrawLooper::ShadowTransformMode = DrawLooper::ShadowRespectsTransforms,
302 DrawLooper::ShadowAlphaMode = DrawLooper::ShadowRespectsAlpha); 304 DrawLooper::ShadowAlphaMode = DrawLooper::ShadowRespectsAlpha);
303 void clearShadow() { clearDrawLooper(); } 305 void clearShadow() { clearDrawLooper(); }
304 306
305 // It is assumed that this draw looper is used only for shadows 307 // It is assumed that this draw looper is used only for shadows
306 // (i.e. a draw looper is set if and only if there is a shadow). 308 // (i.e. a draw looper is set if and only if there is a shadow).
307 void setDrawLooper(const DrawLooper&); 309 void setDrawLooper(const DrawLooper&);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 void drawInnerPath(const SkPath&, SkPaint&, int); 403 void drawInnerPath(const SkPath&, SkPaint&, int);
402 404
403 // SkCanvas wrappers. 405 // SkCanvas wrappers.
404 bool isDrawingToLayer() const { return m_canvas->isDrawingToLayer(); } 406 bool isDrawingToLayer() const { return m_canvas->isDrawingToLayer(); }
405 407
406 bool clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op); 408 bool clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op);
407 bool clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion:: Op = SkRegion::kIntersect_Op); 409 bool clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion:: Op = SkRegion::kIntersect_Op);
408 410
409 bool concat(const SkMatrix&); 411 bool concat(const SkMatrix&);
410 412
411 // Used when restoring and the state has an image clip. Only shows the pixel s in
412 // m_canvas that are also in imageBuffer.
413 // The clipping rectangle is given in absolute coordinates.
414 void applyClipFromImage(const SkRect&, const SkBitmap&);
415
416 // common code between setupPaintFor[Filling,Stroking] 413 // common code between setupPaintFor[Filling,Stroking]
417 void setupShader(SkPaint*, Gradient*, Pattern*, SkColor) const; 414 void setupShader(SkPaint*, Gradient*, Pattern*, SkColor) const;
418 415
419 // Apply deferred saves 416 // Apply deferred saves
420 void realizeSave(SkCanvas::SaveFlags flags) 417 void realizeSave(SkCanvas::SaveFlags flags)
421 { 418 {
422 if (m_deferredSaveFlags & flags) { 419 if (m_deferredSaveFlags & flags) {
423 m_canvas->save((SkCanvas::SaveFlags)m_deferredSaveFlags); 420 m_canvas->save((SkCanvas::SaveFlags)m_deferredSaveFlags);
424 m_deferredSaveFlags = 0; 421 m_deferredSaveFlags = 0;
425 } 422 }
(...skipping 17 matching lines...) Expand all
443 // It will come in handy when adding granular save() support (clip vs . matrix vs. paint). 440 // It will come in handy when adding granular save() support (clip vs . matrix vs. paint).
444 // crbug.com/233713 441 // crbug.com/233713
445 struct DeferredSaveState; 442 struct DeferredSaveState;
446 unsigned m_deferredSaveFlags; 443 unsigned m_deferredSaveFlags;
447 Vector<DeferredSaveState> m_saveStateStack; 444 Vector<DeferredSaveState> m_saveStateStack;
448 445
449 AnnotationModeFlags m_annotationMode; 446 AnnotationModeFlags m_annotationMode;
450 447
451 #if !ASSERT_DISABLED 448 #if !ASSERT_DISABLED
452 unsigned m_annotationCount; 449 unsigned m_annotationCount;
453 unsigned m_transparencyCount; 450 unsigned m_layerCount;
454 #endif 451 #endif
455 // Tracks the region painted opaque via the GraphicsContext. 452 // Tracks the region painted opaque via the GraphicsContext.
456 OpaqueRegionSkia m_opaqueRegion; 453 OpaqueRegionSkia m_opaqueRegion;
457 bool m_trackOpaqueRegion : 1; 454 bool m_trackOpaqueRegion : 1;
458 455
459 // Tracks the region where text is painted via the GraphicsContext. 456 // Tracks the region where text is painted via the GraphicsContext.
460 bool m_trackTextRegion : 1; 457 bool m_trackTextRegion : 1;
461 SkRect m_textRegion; 458 SkRect m_textRegion;
462 459
463 // Are we on a high DPI display? If so, spelling and grammar markers are lar ger. 460 // Are we on a high DPI display? If so, spelling and grammar markers are lar ger.
464 bool m_useHighResMarker : 1; 461 bool m_useHighResMarker : 1;
465 // FIXME: Make this go away: crbug.com/236892 462 // FIXME: Make this go away: crbug.com/236892
466 bool m_updatingControlTints : 1; 463 bool m_updatingControlTints : 1;
467 bool m_accelerated : 1; 464 bool m_accelerated : 1;
468 bool m_isCertainlyOpaque : 1; 465 bool m_isCertainlyOpaque : 1;
469 bool m_printing : 1; 466 bool m_printing : 1;
470 }; 467 };
471 468
472 } // namespace WebCore 469 } // namespace WebCore
473 470
474 #endif // GraphicsContext_h 471 #endif // GraphicsContext_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/CrossfadeGeneratedImage.cpp ('k') | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698