| 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 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ | 28 #ifndef SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ |
| 29 #define SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ | 29 #define SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ |
| 30 | 30 |
| 31 #include "sky/engine/platform/PlatformExport.h" | 31 #include "sky/engine/platform/PlatformExport.h" |
| 32 #include "sky/engine/platform/fonts/Font.h" | 32 #include "sky/engine/platform/fonts/Font.h" |
| 33 #include "sky/engine/platform/geometry/FloatRect.h" | 33 #include "sky/engine/platform/geometry/FloatRect.h" |
| 34 #include "sky/engine/platform/graphics/DashArray.h" | 34 #include "sky/engine/platform/graphics/DashArray.h" |
| 35 #include "sky/engine/platform/graphics/DrawLooperBuilder.h" | 35 #include "sky/engine/platform/graphics/DrawLooperBuilder.h" |
| 36 #include "sky/engine/platform/graphics/GraphicsContextAnnotation.h" | |
| 37 #include "sky/engine/platform/graphics/GraphicsContextState.h" | 36 #include "sky/engine/platform/graphics/GraphicsContextState.h" |
| 38 #include "sky/engine/platform/graphics/ImageBufferSurface.h" | 37 #include "sky/engine/platform/graphics/ImageBufferSurface.h" |
| 39 #include "sky/engine/platform/graphics/ImageFilter.h" | 38 #include "sky/engine/platform/graphics/ImageFilter.h" |
| 40 #include "sky/engine/platform/graphics/ImageOrientation.h" | 39 #include "sky/engine/platform/graphics/ImageOrientation.h" |
| 41 #include "sky/engine/platform/graphics/RegionTracker.h" | 40 #include "sky/engine/platform/graphics/RegionTracker.h" |
| 42 #include "sky/engine/platform/graphics/skia/SkiaUtils.h" | 41 #include "sky/engine/platform/graphics/skia/SkiaUtils.h" |
| 43 #include "sky/engine/wtf/FastAllocBase.h" | 42 #include "sky/engine/wtf/FastAllocBase.h" |
| 44 #include "sky/engine/wtf/Forward.h" | 43 #include "sky/engine/wtf/Forward.h" |
| 45 #include "sky/engine/wtf/Noncopyable.h" | 44 #include "sky/engine/wtf/Noncopyable.h" |
| 46 #include "sky/engine/wtf/PassOwnPtr.h" | 45 #include "sky/engine/wtf/PassOwnPtr.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 }; | 209 }; |
| 211 void setRegionTrackingMode(RegionTrackingMode); | 210 void setRegionTrackingMode(RegionTrackingMode); |
| 212 bool regionTrackingEnabled() { return m_regionTrackingMode != RegionTracking
Disabled; } | 211 bool regionTrackingEnabled() { return m_regionTrackingMode != RegionTracking
Disabled; } |
| 213 const RegionTracker& opaqueRegion() const { return m_trackedRegion; } | 212 const RegionTracker& opaqueRegion() const { return m_trackedRegion; } |
| 214 | 213 |
| 215 // The text region is empty until tracking is turned on. | 214 // The text region is empty until tracking is turned on. |
| 216 // It is never clerared by the context. | 215 // It is never clerared by the context. |
| 217 void setTrackTextRegion(bool track) { m_trackTextRegion = track; } | 216 void setTrackTextRegion(bool track) { m_trackTextRegion = track; } |
| 218 const SkRect& textRegion() const { return m_textRegion; } | 217 const SkRect& textRegion() const { return m_textRegion; } |
| 219 | 218 |
| 220 AnnotationModeFlags annotationMode() const { return m_annotationMode; } | |
| 221 void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode =
mode; } | |
| 222 | |
| 223 SkColorFilter* colorFilter() const; | 219 SkColorFilter* colorFilter() const; |
| 224 void setColorFilter(ColorFilter); | 220 void setColorFilter(ColorFilter); |
| 225 // ---------- End state management methods ----------------- | 221 // ---------- End state management methods ----------------- |
| 226 | 222 |
| 227 // Get the contents of the image buffer | 223 // Get the contents of the image buffer |
| 228 bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, in
t y); | 224 bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, in
t y); |
| 229 | 225 |
| 230 // Get the current fill style. | 226 // Get the current fill style. |
| 231 const SkPaint& fillPaint() const { return immutableState()->fillPaint(); } | 227 const SkPaint& fillPaint() const { return immutableState()->fillPaint(); } |
| 232 | 228 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 void setURLForRect(const KURL&, const IntRect&); | 377 void setURLForRect(const KURL&, const IntRect&); |
| 382 void setURLFragmentForRect(const String& name, const IntRect&); | 378 void setURLFragmentForRect(const String& name, const IntRect&); |
| 383 void addURLTargetAtPoint(const String& name, const IntPoint&); | 379 void addURLTargetAtPoint(const String& name, const IntPoint&); |
| 384 | 380 |
| 385 // Create an image buffer compatible with this context, with suitable resolu
tion | 381 // Create an image buffer compatible with this context, with suitable resolu
tion |
| 386 // for drawing into the buffer and then into this context. | 382 // for drawing into the buffer and then into this context. |
| 387 PassOwnPtr<ImageBuffer> createRasterBuffer(const IntSize&, OpacityMode = Non
Opaque) const; | 383 PassOwnPtr<ImageBuffer> createRasterBuffer(const IntSize&, OpacityMode = Non
Opaque) const; |
| 388 | 384 |
| 389 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); | 385 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, floa
t strokeWidth, StrokeStyle); |
| 390 | 386 |
| 391 void beginAnnotation(const AnnotationList&); | |
| 392 void endAnnotation(); | |
| 393 | |
| 394 void preparePaintForDrawRectToRect( | 387 void preparePaintForDrawRectToRect( |
| 395 SkPaint*, | 388 SkPaint*, |
| 396 const SkRect& srcRect, | 389 const SkRect& srcRect, |
| 397 const SkRect& destRect, | 390 const SkRect& destRect, |
| 398 CompositeOperator, | 391 CompositeOperator, |
| 399 WebBlendMode, | 392 WebBlendMode, |
| 400 bool isLazyDecoded = false, | 393 bool isLazyDecoded = false, |
| 401 bool isDataComplete = true) const; | 394 bool isDataComplete = true) const; |
| 402 | 395 |
| 403 static int focusRingOutsetExtent(int offset, int width) | 396 static int focusRingOutsetExtent(int offset, int width) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // Raw pointer to the current state. | 480 // Raw pointer to the current state. |
| 488 GraphicsContextState* m_paintState; | 481 GraphicsContextState* m_paintState; |
| 489 | 482 |
| 490 // Currently pending save flags for Skia Canvas state. | 483 // Currently pending save flags for Skia Canvas state. |
| 491 // Canvas state includes the canavs, it's matrix and clips. Think of it as _
where_ | 484 // Canvas state includes the canavs, it's matrix and clips. Think of it as _
where_ |
| 492 // the draw operations will happen. | 485 // the draw operations will happen. |
| 493 struct CanvasSaveState; | 486 struct CanvasSaveState; |
| 494 Vector<CanvasSaveState> m_canvasStateStack; | 487 Vector<CanvasSaveState> m_canvasStateStack; |
| 495 bool m_pendingCanvasSave; | 488 bool m_pendingCanvasSave; |
| 496 | 489 |
| 497 AnnotationModeFlags m_annotationMode; | |
| 498 | |
| 499 struct RecordingState; | 490 struct RecordingState; |
| 500 Vector<RecordingState> m_recordingStateStack; | 491 Vector<RecordingState> m_recordingStateStack; |
| 501 | 492 |
| 502 #if ENABLE(ASSERT) | 493 #if ENABLE(ASSERT) |
| 503 unsigned m_annotationCount; | |
| 504 unsigned m_layerCount; | 494 unsigned m_layerCount; |
| 505 bool m_disableDestructionChecks; | 495 bool m_disableDestructionChecks; |
| 506 #endif | 496 #endif |
| 507 // Tracks the region painted opaque via the GraphicsContext. | 497 // Tracks the region painted opaque via the GraphicsContext. |
| 508 RegionTracker m_trackedRegion; | 498 RegionTracker m_trackedRegion; |
| 509 | 499 |
| 510 // Tracks the region where text is painted via the GraphicsContext. | 500 // Tracks the region where text is painted via the GraphicsContext. |
| 511 SkRect m_textRegion; | 501 SkRect m_textRegion; |
| 512 | 502 |
| 513 unsigned m_disabledState; | 503 unsigned m_disabledState; |
| 514 | 504 |
| 515 float m_deviceScaleFactor; | 505 float m_deviceScaleFactor; |
| 516 | 506 |
| 517 // Activation for the above region tracking features | 507 // Activation for the above region tracking features |
| 518 unsigned m_regionTrackingMode : 2; | 508 unsigned m_regionTrackingMode : 2; |
| 519 bool m_trackTextRegion : 1; | 509 bool m_trackTextRegion : 1; |
| 520 | 510 |
| 521 bool m_accelerated : 1; | 511 bool m_accelerated : 1; |
| 522 bool m_isCertainlyOpaque : 1; | 512 bool m_isCertainlyOpaque : 1; |
| 523 bool m_antialiasHairlineImages : 1; | 513 bool m_antialiasHairlineImages : 1; |
| 524 bool m_shouldSmoothFonts : 1; | 514 bool m_shouldSmoothFonts : 1; |
| 525 }; | 515 }; |
| 526 | 516 |
| 527 } // namespace blink | 517 } // namespace blink |
| 528 | 518 |
| 529 #endif // SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ | 519 #endif // SKY_ENGINE_PLATFORM_GRAPHICS_GRAPHICSCONTEXT_H_ |
| OLD | NEW |