OSDN Git Service

drawRect is defined (in header) to always stroke with 1.0
authorMike Reed <reed@google.com>
Wed, 24 Mar 2010 17:33:09 +0000 (13:33 -0400)
committerMike Reed <reed@google.com>
Wed, 24 Mar 2010 17:33:09 +0000 (13:33 -0400)
Change-Id: I95bef5b769c9b2637424ae4f22ccd19ed6e4ff9a

WebCore/platform/graphics/android/GraphicsContextAndroid.cpp

index 93b7562..369dce2 100644 (file)
@@ -416,10 +416,16 @@ void GraphicsContext::drawRect(const IntRect& rect)
         m_data->setup_paint_fill(&paint);
         GC2Canvas(this)->drawRect(r, paint);
     }
-    
+
+    /*  According to GraphicsContext.h, stroking inside drawRect always means
+        a stroke of 1 inside the rect.
+     */
     if (strokeStyle() != NoStroke && strokeColor().alpha()) {
         paint.reset();
         m_data->setup_paint_stroke(&paint, &r);
+        paint.setPathEffect(NULL);              // no dashing please
+        paint.setStrokeWidth(SK_Scalar1);       // always just 1.0 width
+        r.inset(SK_ScalarHalf, SK_ScalarHalf);  // ensure we're "inside"
         GC2Canvas(this)->drawRect(r, paint);
     }
 }