OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "platform/graphics/DrawLooperBuilder.h" | 34 #include "platform/graphics/DrawLooperBuilder.h" |
35 #include "platform/graphics/GraphicsContextState.h" | 35 #include "platform/graphics/GraphicsContextState.h" |
36 #include "platform/graphics/ImageOrientation.h" | 36 #include "platform/graphics/ImageOrientation.h" |
37 #include "platform/graphics/skia/SkiaUtils.h" | 37 #include "platform/graphics/skia/SkiaUtils.h" |
38 #include "third_party/skia/include/core/SkMetaData.h" | 38 #include "third_party/skia/include/core/SkMetaData.h" |
39 #include "third_party/skia/include/core/SkPictureRecorder.h" | 39 #include "third_party/skia/include/core/SkPictureRecorder.h" |
40 #include "third_party/skia/include/core/SkRegion.h" | 40 #include "third_party/skia/include/core/SkRegion.h" |
41 #include "wtf/Allocator.h" | 41 #include "wtf/Allocator.h" |
42 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
43 #include "wtf/Noncopyable.h" | 43 #include "wtf/Noncopyable.h" |
44 #include "wtf/PassOwnPtr.h" | 44 #include <memory> |
45 | 45 |
46 class SkBitmap; | 46 class SkBitmap; |
47 class SkImage; | 47 class SkImage; |
48 class SkPaint; | 48 class SkPaint; |
49 class SkPath; | 49 class SkPath; |
50 class SkPicture; | 50 class SkPicture; |
51 class SkRRect; | 51 class SkRRect; |
52 class SkTextBlob; | 52 class SkTextBlob; |
53 struct SkImageInfo; | 53 struct SkImageInfo; |
54 struct SkRect; | 54 struct SkRect; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // even when the context is disabled. | 208 // even when the context is disabled. |
209 PassRefPtr<SkPicture> endRecording(); | 209 PassRefPtr<SkPicture> endRecording(); |
210 | 210 |
211 void setShadow(const FloatSize& offset, float blur, const Color&, | 211 void setShadow(const FloatSize& offset, float blur, const Color&, |
212 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, | 212 DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespec
tsTransforms, |
213 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha, ShadowMode = DrawShadowAndForeground); | 213 DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAl
pha, ShadowMode = DrawShadowAndForeground); |
214 | 214 |
215 // It is assumed that this draw looper is used only for shadows | 215 // It is assumed that this draw looper is used only for shadows |
216 // (i.e. a draw looper is set if and only if there is a shadow). | 216 // (i.e. a draw looper is set if and only if there is a shadow). |
217 // The builder passed into this method will be destroyed. | 217 // The builder passed into this method will be destroyed. |
218 void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); | 218 void setDrawLooper(std::unique_ptr<DrawLooperBuilder>); |
219 | 219 |
220 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo
r&); | 220 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Colo
r&); |
221 void drawFocusRing(const Path&, int width, int offset, const Color&); | 221 void drawFocusRing(const Path&, int width, int offset, const Color&); |
222 | 222 |
223 enum Edge { | 223 enum Edge { |
224 NoEdge = 0, | 224 NoEdge = 0, |
225 TopEdge = 1 << 1, | 225 TopEdge = 1 << 1, |
226 RightEdge = 1 << 2, | 226 RightEdge = 1 << 2, |
227 BottomEdge = 1 << 3, | 227 BottomEdge = 1 << 3, |
228 LeftEdge = 1 << 4 | 228 LeftEdge = 1 << 4 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const SkMetaData& metaData() const { return m_metaData; } | 336 const SkMetaData& metaData() const { return m_metaData; } |
337 | 337 |
338 // null indicates painting is contextDisabled. Never delete this object. | 338 // null indicates painting is contextDisabled. Never delete this object. |
339 SkCanvas* m_canvas; | 339 SkCanvas* m_canvas; |
340 | 340 |
341 PaintController& m_paintController; | 341 PaintController& m_paintController; |
342 | 342 |
343 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. | 343 // Paint states stack. Enables local drawing state change with save()/restor
e() calls. |
344 // This state controls the appearance of drawn content. | 344 // This state controls the appearance of drawn content. |
345 // We do not delete from this stack to avoid memory churn. | 345 // We do not delete from this stack to avoid memory churn. |
346 Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; | 346 Vector<std::unique_ptr<GraphicsContextState>> m_paintStateStack; |
347 // Current index on the stack. May not be the last thing on the stack. | 347 // Current index on the stack. May not be the last thing on the stack. |
348 unsigned m_paintStateIndex; | 348 unsigned m_paintStateIndex; |
349 // Raw pointer to the current state. | 349 // Raw pointer to the current state. |
350 GraphicsContextState* m_paintState; | 350 GraphicsContextState* m_paintState; |
351 | 351 |
352 SkPictureRecorder m_pictureRecorder; | 352 SkPictureRecorder m_pictureRecorder; |
353 | 353 |
354 SkMetaData m_metaData; | 354 SkMetaData m_metaData; |
355 | 355 |
356 #if ENABLE(ASSERT) | 356 #if ENABLE(ASSERT) |
357 unsigned m_layerCount; | 357 unsigned m_layerCount; |
358 bool m_disableDestructionChecks; | 358 bool m_disableDestructionChecks; |
359 bool m_inDrawingRecorder; | 359 bool m_inDrawingRecorder; |
360 #endif | 360 #endif |
361 | 361 |
362 const DisabledMode m_disabledState; | 362 const DisabledMode m_disabledState; |
363 | 363 |
364 float m_deviceScaleFactor; | 364 float m_deviceScaleFactor; |
365 | 365 |
366 unsigned m_printing : 1; | 366 unsigned m_printing : 1; |
367 unsigned m_hasMetaData : 1; | 367 unsigned m_hasMetaData : 1; |
368 }; | 368 }; |
369 | 369 |
370 } // namespace blink | 370 } // namespace blink |
371 | 371 |
372 #endif // GraphicsContext_h | 372 #endif // GraphicsContext_h |
OLD | NEW |