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

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

Issue 536573002: Modifications to DisplayList for better Slimming Paint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Testing FIXME Created 6 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
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void didDrawRect(const SkRect&, const SkPaint&, const SkBitmap* = 0); 303 void didDrawRect(const SkRect&, const SkPaint&, const SkBitmap* = 0);
304 void drawRect(const SkRect&, const SkPaint&); 304 void drawRect(const SkRect&, const SkPaint&);
305 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c onst SkRect& textRect, const SkPaint&); 305 void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], c onst SkRect& textRect, const SkPaint&);
306 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY, const SkRect& textRect, const SkPaint&); 306 void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[] , SkScalar constY, const SkRect& textRect, const SkPaint&);
307 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&); 307 void drawTextBlob(const SkTextBlob*, const SkPoint& origin, const SkPaint&);
308 308
309 void clip(const IntRect& rect) { clipRect(rect); } 309 void clip(const IntRect& rect) { clipRect(rect); }
310 void clip(const FloatRect& rect) { clipRect(rect); } 310 void clip(const FloatRect& rect) { clipRect(rect); }
311 void clipRoundedRect(const RoundedRect&, SkRegion::Op = SkRegion::kIntersect _Op); 311 void clipRoundedRect(const RoundedRect&, SkRegion::Op = SkRegion::kIntersect _Op);
312 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); } 312 void clipOut(const IntRect& rect) { clipRect(rect, NotAntiAliased, SkRegion: :kDifference_Op); }
313 void clipOut(const Path&);
313 void clipOutRoundedRect(const RoundedRect&); 314 void clipOutRoundedRect(const RoundedRect&);
314 void clipPath(const Path&, WindRule = RULE_EVENODD); 315 void clipPath(const Path&, WindRule = RULE_EVENODD);
315 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); 316 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
316 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op); 317 void clipRect(const SkRect&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op);
318 // This clip function is used only by <canvas> code. It allows
319 // implementations to handle clipping on the canvas differently since
320 // the discipline is different.
321 void canvasClip(const Path&, WindRule = RULE_EVENODD);
317 322
318 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&); 323 void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&);
319 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr ing& mark, const FloatPoint&); 324 void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicStr ing& mark, const FloatPoint&);
320 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady); 325 void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, F ont::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady);
321 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in t h, const Color& backgroundColor, int from = 0, int to = -1); 326 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, in t h, const Color& backgroundColor, int from = 0, int to = -1);
322 327
323 void drawLineForText(const FloatPoint&, float width, bool printing); 328 void drawLineForText(const FloatPoint&, float width, bool printing);
324 enum DocumentMarkerLineStyle { 329 enum DocumentMarkerLineStyle {
325 DocumentMarkerSpellingLineStyle, 330 DocumentMarkerSpellingLineStyle,
326 DocumentMarkerGrammarLineStyle 331 DocumentMarkerGrammarLineStyle
327 }; 332 };
328 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke rLineStyle); 333 void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarke rLineStyle);
329 334
330 void beginTransparencyLayer(float opacity, const FloatRect* = 0); 335 void beginTransparencyLayer(float opacity, const FloatRect* = 0);
331 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo rFilter = ColorFilterNone, ImageFilter* = 0); 336 void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, Colo rFilter = ColorFilterNone, ImageFilter* = 0);
332 void endLayer(); 337 void endLayer();
333 338
334 void beginCull(const FloatRect&); 339 void beginCull(const FloatRect&);
335 void endCull(); 340 void endCull();
336 341
337 // Instead of being dispatched to the active canvas, draw commands following beginRecording() 342 // Instead of being dispatched to the active canvas, draw commands following beginRecording()
338 // are stored in a display list that can be replayed at a later time. 343 // are stored in a display list that can be replayed at a later time. Pass i n the bounding
339 void beginRecording(const FloatRect& bounds); 344 // rectangle for the content in the list.
345 void beginRecording(const FloatRect&, uint32_t = 0);
340 PassRefPtr<DisplayList> endRecording(); 346 PassRefPtr<DisplayList> endRecording();
341 347
342 bool hasShadow() const; 348 bool hasShadow() const;
343 void setShadow(const FloatSize& offset, float blur, const Color&, 349 void setShadow(const FloatSize& offset, float blur, const Color&,
344 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec tsTransforms, 350 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec tsTransforms,
345 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl pha); 351 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl pha);
346 void clearShadow() { clearDrawLooper(); } 352 void clearShadow() { clearDrawLooper(); }
347 353
348 // It is assumed that this draw looper is used only for shadows 354 // It is assumed that this draw looper is used only for shadows
349 // (i.e. a draw looper is set if and only if there is a shadow). 355 // (i.e. a draw looper is set if and only if there is a shadow).
350 // The builder passed into this method will be destroyed. 356 // The builder passed into this method will be destroyed.
351 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); 357 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>);
352 void clearDrawLooper(); 358 void clearDrawLooper();
353 359
354 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo r&); 360 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo r&);
355 void drawFocusRing(const Path&, int width, int offset, const Color&); 361 void drawFocusRing(const Path&, int width, int offset, const Color&);
356 362
357 enum Edge { 363 enum Edge {
358 NoEdge = 0, 364 NoEdge = 0,
359 TopEdge = 1 << 1, 365 TopEdge = 1 << 1,
360 RightEdge = 1 << 2, 366 RightEdge = 1 << 2,
361 BottomEdge = 1 << 3, 367 BottomEdge = 1 << 3,
362 LeftEdge = 1 << 4 368 LeftEdge = 1 << 4
363 }; 369 };
364 typedef unsigned Edges; 370 typedef unsigned Edges;
365 void drawInnerShadow(const RoundedRect&, const Color& shadowColor, const Int Size shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge ); 371 void drawInnerShadow(const RoundedRect&, const Color& shadowColor, const Int Size shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge );
366 372
367 // This clip function is used only by <canvas> code. It allows
368 // implementations to handle clipping on the canvas differently since
369 // the discipline is different.
370 void canvasClip(const Path&, WindRule = RULE_EVENODD);
371 void clipOut(const Path&);
372
373 // ---------- Transformation methods ----------------- 373 // ---------- Transformation methods -----------------
374 // Note that the getCTM method returns only the current transform from Blink 's perspective, 374 // Note that the getCTM method returns only the current transform from Blink 's perspective,
375 // which is not the final transform used to place content on screen. It cann ot be relied upon 375 // which is not the final transform used to place content on screen. It cann ot be relied upon
376 // for testing where a point will appear on screen or how large it will be. 376 // for testing where a point will appear on screen or how large it will be.
377 AffineTransform getCTM() const; 377 AffineTransform getCTM() const;
378 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa trix(affine)); } 378 void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMa trix(affine)); }
379 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa trix(affine)); } 379 void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMa trix(affine)); }
380 void setMatrix(const SkMatrix&); 380 void setMatrix(const SkMatrix&);
381 381
382 void scale(float x, float y); 382 void scale(float x, float y);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 static const SkPMColor antiColors2(int); 441 static const SkPMColor antiColors2(int);
442 static void draw1xMarker(SkBitmap*, int); 442 static void draw1xMarker(SkBitmap*, int);
443 static void draw2xMarker(SkBitmap*, int); 443 static void draw2xMarker(SkBitmap*, int);
444 #endif 444 #endif
445 445
446 // Helpers for drawing a focus ring (drawFocusRing) 446 // Helpers for drawing a focus ring (drawFocusRing)
447 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const; 447 float prepareFocusRingPaint(SkPaint&, const Color&, int width) const;
448 void drawFocusRingPath(const SkPath&, const Color&, int width); 448 void drawFocusRingPath(const SkPath&, const Color&, int width);
449 void drawFocusRingRect(const SkRect&, const Color&, int width); 449 void drawFocusRingRect(const SkRect&, const Color&, int width);
450 450
451
452 // SkCanvas wrappers. 451 // SkCanvas wrappers.
453 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op); 452 void clipPath(const SkPath&, AntiAliasingMode = NotAntiAliased, SkRegion::Op = SkRegion::kIntersect_Op);
454 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion:: Op = SkRegion::kIntersect_Op); 453 void clipRRect(const SkRRect&, AntiAliasingMode = NotAntiAliased, SkRegion:: Op = SkRegion::kIntersect_Op);
455 void concat(const SkMatrix&); 454 void concat(const SkMatrix&);
456 void drawRRect(const SkRRect&, const SkPaint&); 455 void drawRRect(const SkRRect&, const SkPaint&);
457 456
458 // Apply deferred paint state saves 457 // Apply deferred paint state saves
459 void realizePaintSave() 458 void realizePaintSave()
460 { 459 {
461 if (contextDisabled()) 460 if (contextDisabled())
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 bool m_accelerated : 1; 536 bool m_accelerated : 1;
538 bool m_isCertainlyOpaque : 1; 537 bool m_isCertainlyOpaque : 1;
539 bool m_printing : 1; 538 bool m_printing : 1;
540 bool m_antialiasHairlineImages : 1; 539 bool m_antialiasHairlineImages : 1;
541 bool m_shouldSmoothFonts : 1; 540 bool m_shouldSmoothFonts : 1;
542 }; 541 };
543 542
544 } // namespace blink 543 } // namespace blink
545 544
546 #endif // GraphicsContext_h 545 #endif // GraphicsContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698