| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #ifndef GraphicsContext_h | 28 #ifndef GraphicsContext_h |
| 29 #define GraphicsContext_h | 29 #define GraphicsContext_h |
| 30 | 30 |
| 31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 32 #include "platform/TraceEvent.h" | 32 #include "platform/TraceEvent.h" |
| 33 #include "platform/fonts/Font.h" | 33 #include "platform/fonts/Font.h" |
| 34 #include "platform/geometry/FloatRect.h" | 34 #include "platform/geometry/FloatRect.h" |
| 35 #include "platform/graphics/DashArray.h" | 35 #include "platform/graphics/DashArray.h" |
| 36 #include "platform/graphics/DrawLooper.h" | 36 #include "platform/graphics/DrawLooper.h" |
| 37 #include "platform/graphics/ImageBuffer.h" | 37 #include "platform/graphics/ImageBufferSurface.h" |
| 38 #include "platform/graphics/ImageOrientation.h" | 38 #include "platform/graphics/ImageOrientation.h" |
| 39 #include "platform/graphics/GraphicsContextAnnotation.h" | 39 #include "platform/graphics/GraphicsContextAnnotation.h" |
| 40 #include "platform/graphics/GraphicsContextState.h" | 40 #include "platform/graphics/GraphicsContextState.h" |
| 41 #include "platform/graphics/skia/OpaqueRegionSkia.h" | 41 #include "platform/graphics/skia/OpaqueRegionSkia.h" |
| 42 #include "platform/graphics/skia/SkiaUtils.h" | 42 #include "platform/graphics/skia/SkiaUtils.h" |
| 43 // TODO(robertphillips): replace this include with "class SkBaseDevice;" | 43 // TODO(robertphillips): replace this include with "class SkBaseDevice;" |
| 44 #include "third_party/skia/include/core/SkDevice.h" | 44 #include "third_party/skia/include/core/SkDevice.h" |
| 45 #include "wtf/FastAllocBase.h" | 45 #include "wtf/FastAllocBase.h" |
| 46 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
| 47 #include "wtf/Noncopyable.h" | 47 #include "wtf/Noncopyable.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 realizeSave(SkCanvas::kMatrixClip_SaveFlag); | 83 realizeSave(SkCanvas::kMatrixClip_SaveFlag); |
| 84 | 84 |
| 85 return m_canvas; | 85 return m_canvas; |
| 86 } | 86 } |
| 87 const SkCanvas* canvas() const { return m_canvas; } | 87 const SkCanvas* canvas() const { return m_canvas; } |
| 88 bool paintingDisabled() const { return !m_canvas; } | 88 bool paintingDisabled() const { return !m_canvas; } |
| 89 | 89 |
| 90 const SkBitmap* bitmap() const; | 90 const SkBitmap* bitmap() const; |
| 91 const SkBitmap& layerBitmap(AccessMode = ReadOnly) const; | 91 const SkBitmap& layerBitmap(AccessMode = ReadOnly) const; |
| 92 | 92 |
| 93 SkBaseDevice* createCompatibleDevice(const IntSize&, bool hasAlpha) const; | |
| 94 | |
| 95 // ---------- State management methods ----------------- | 93 // ---------- State management methods ----------------- |
| 96 void save(); | 94 void save(); |
| 97 void restore(); | 95 void restore(); |
| 98 | 96 |
| 99 void saveLayer(const SkRect* bounds, const SkPaint*, SkCanvas::SaveFlags = S
kCanvas::kARGB_ClipLayer_SaveFlag); | 97 void saveLayer(const SkRect* bounds, const SkPaint*, SkCanvas::SaveFlags = S
kCanvas::kARGB_ClipLayer_SaveFlag); |
| 100 void restoreLayer(); | 98 void restoreLayer(); |
| 101 | 99 |
| 102 float strokeThickness() const { return m_state->m_strokeData.thickness(); } | 100 float strokeThickness() const { return m_state->m_strokeData.thickness(); } |
| 103 void setStrokeThickness(float thickness) { m_state->m_strokeData.setThicknes
s(thickness); } | 101 void setStrokeThickness(float thickness) { m_state->m_strokeData.setThicknes
s(thickness); } |
| 104 | 102 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // ---------- End transformation methods ----------------- | 359 // ---------- End transformation methods ----------------- |
| 362 | 360 |
| 363 // URL drawing | 361 // URL drawing |
| 364 void setURLForRect(const KURL&, const IntRect&); | 362 void setURLForRect(const KURL&, const IntRect&); |
| 365 void setURLFragmentForRect(const String& name, const IntRect&); | 363 void setURLFragmentForRect(const String& name, const IntRect&); |
| 366 void addURLTargetAtPoint(const String& name, const IntPoint&); | 364 void addURLTargetAtPoint(const String& name, const IntPoint&); |
| 367 bool supportsURLFragments() { return printing(); } | 365 bool supportsURLFragments() { return printing(); } |
| 368 | 366 |
| 369 // Create an image buffer compatible with this context, with suitable resolu
tion | 367 // Create an image buffer compatible with this context, with suitable resolu
tion |
| 370 // for drawing into the buffer and then into this context. | 368 // for drawing into the buffer and then into this context. |
| 371 PassOwnPtr<ImageBuffer> createCompatibleBuffer(const IntSize&, bool hasAlpha
= true) const; | 369 PassOwnPtr<ImageBuffer> createCompatibleBuffer(const IntSize&, OpacityMode =
NonOpaque) const; |
| 372 | 370 |
| 373 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); | 371 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); |
| 374 | 372 |
| 375 void beginAnnotation(const char*, const char*, const String&, const String&,
const String&); | 373 void beginAnnotation(const char*, const char*, const String&, const String&,
const String&); |
| 376 void endAnnotation(); | 374 void endAnnotation(); |
| 377 | 375 |
| 378 private: | 376 private: |
| 379 static void addCornerArc(SkPath*, const SkRect&, const IntSize&, int); | 377 static void addCornerArc(SkPath*, const SkRect&, const IntSize&, int); |
| 380 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); | 378 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); |
| 381 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); | 379 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // FIXME: Make this go away: crbug.com/236892 | 481 // FIXME: Make this go away: crbug.com/236892 |
| 484 bool m_updatingControlTints : 1; | 482 bool m_updatingControlTints : 1; |
| 485 bool m_accelerated : 1; | 483 bool m_accelerated : 1; |
| 486 bool m_isCertainlyOpaque : 1; | 484 bool m_isCertainlyOpaque : 1; |
| 487 bool m_printing : 1; | 485 bool m_printing : 1; |
| 488 }; | 486 }; |
| 489 | 487 |
| 490 } // namespace WebCore | 488 } // namespace WebCore |
| 491 | 489 |
| 492 #endif // GraphicsContext_h | 490 #endif // GraphicsContext_h |
| OLD | NEW |