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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 907453003: Move overdraw tracking code from GraphicsContext to CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // Text state. 268 // Text state.
269 TextAlign m_textAlign; 269 TextAlign m_textAlign;
270 TextBaseline m_textBaseline; 270 TextBaseline m_textBaseline;
271 Direction m_direction; 271 Direction m_direction;
272 272
273 String m_unparsedFont; 273 String m_unparsedFont;
274 Font m_font; 274 Font m_font;
275 bool m_realizedFont; 275 bool m_realizedFont;
276 276
277 bool m_hasClip; 277 bool m_hasClip;
278 bool m_hasComplexClip;
278 279
279 ClipList m_clipList; 280 ClipList m_clipList;
280 }; 281 };
281 282
282 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); 283 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&);
283 284
284 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m _stateStack.last(); } 285 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m _stateStack.last(); }
285 const State& state() const { return *m_stateStack.last(); } 286 const State& state() const { return *m_stateStack.last(); }
286 287
287 void applyLineDash() const; 288 void applyLineDash() const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw); 331 void fullCanvasCompositedDraw(PassOwnPtr<Closure> draw);
331 332
332 void drawFocusIfNeededInternal(const Path&, Element*); 333 void drawFocusIfNeededInternal(const Path&, Element*);
333 bool focusRingCallIsValid(const Path&, Element*); 334 bool focusRingCallIsValid(const Path&, Element*);
334 void drawFocusRing(const Path&); 335 void drawFocusRing(const Path&);
335 336
336 bool hasClip() { return state().m_hasClip; } 337 bool hasClip() { return state().m_hasClip; }
337 338
338 void validateStateStack(); 339 void validateStateStack();
339 340
341 enum DrawType {
342 NormalFill,
343 ClipFill, // Normal fill that is already known to cover the current clip
344 UntransformedUnclippedFill
345 };
346
347 enum ImageType {
348 NoImage,
349 OpaqueImage,
350 NonOpaqueImage
351 };
352
353 void checkOverdraw(const SkRect&, const SkPaint*, ImageType, DrawType);
354
340 virtual bool is2d() const override { return true; } 355 virtual bool is2d() const override { return true; }
341 virtual bool isAccelerated() const override; 356 virtual bool isAccelerated() const override;
342 virtual bool hasAlpha() const override { return m_hasAlpha; } 357 virtual bool hasAlpha() const override { return m_hasAlpha; }
343 virtual void setIsHidden(bool) override; 358 virtual void setIsHidden(bool) override;
344 359
345 virtual bool isTransformInvertible() const override { return state().m_inver tibleCTM; } 360 virtual bool isTransformInvertible() const override { return state().m_inver tibleCTM; }
346 361
347 virtual WebLayer* platformLayer() const override; 362 virtual WebLayer* platformLayer() const override;
348 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp tr) const; 363 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp tr) const;
349 364
(...skipping 10 matching lines...) Expand all
360 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; 375 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer;
361 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; 376 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer;
362 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; 377 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer;
363 }; 378 };
364 379
365 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 380 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
366 381
367 } // namespace blink 382 } // namespace blink
368 383
369 #endif // CanvasRenderingContext2D_h 384 #endif // CanvasRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698