Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / core / SkDrawLooper.cpp
index bac2d96..d18d127 100644 (file)
 #include "SkMatrix.h"
 #include "SkPaint.h"
 #include "SkRect.h"
+#include "SkSmallAllocator.h"
 
-bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) {
+bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) const {
     SkCanvas canvas;
+    SkSmallAllocator<1, 32> allocator;
+    void* buffer = allocator.reserveT<SkDrawLooper::Context>(this->contextSize());
 
-    this->init(&canvas);
+    SkDrawLooper::Context* context = this->createContext(&canvas, buffer);
     for (;;) {
         SkPaint p(paint);
-        if (this->next(&canvas, &p)) {
+        if (context->next(&canvas, &p)) {
             p.setLooper(NULL);
             if (!p.canComputeFastBounds()) {
                 return false;
@@ -30,14 +33,16 @@ bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) {
 }
 
 void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src,
-                                     SkRect* dst) {
+                                     SkRect* dst) const {
     SkCanvas canvas;
+    SkSmallAllocator<1, 32> allocator;
+    void* buffer = allocator.reserveT<SkDrawLooper::Context>(this->contextSize());
 
     *dst = src;   // catch case where there are no loops
-    this->init(&canvas);
+    SkDrawLooper::Context* context = this->createContext(&canvas, buffer);
     for (bool firstTime = true;; firstTime = false) {
         SkPaint p(paint);
-        if (this->next(&canvas, &p)) {
+        if (context->next(&canvas, &p)) {
             SkRect r(src);
 
             p.setLooper(NULL);
@@ -54,3 +59,7 @@ void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src,
         }
     }
 }
+
+bool SkDrawLooper::asABlurShadow(BlurShadowRec*) const {
+    return false;
+}