Tighten up restrictions on blit width: some shaders assert that they
authortomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 29 Dec 2011 16:09:31 +0000 (16:09 +0000)
committertomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 29 Dec 2011 16:09:31 +0000 (16:09 +0000)
are addressing more than 0 pixels.
codereview.appspot.com/5489125/

git-svn-id: http://skia.googlecode.com/svn/trunk@2935 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkBlitter.h
src/core/SkBlitter.cpp

index e784ef5..ce74a28 100644 (file)
@@ -24,7 +24,7 @@ class SkBlitter {
 public:
     virtual ~SkBlitter();
 
-    /// Blit a horizontal run of zero or more pixels.
+    /// Blit a horizontal run of one or more pixels.
     virtual void blitH(int x, int y, int width);
     /// Blit a horizontal run of antialiased pixels; runs[] is a *sparse*
     /// zero-terminated run-length encoding of spans of constant alpha values.
@@ -32,7 +32,7 @@ public:
                            const int16_t runs[]);
     /// Blit a vertical run of pixels with a constant alpha value.
     virtual void blitV(int x, int y, int height, SkAlpha alpha);
-    /// Blit a solid rectangle zero or more pixels wide.
+    /// Blit a solid rectangle one or more pixels wide.
     virtual void blitRect(int x, int y, int width, int height);
     /** Blit a rectangle with one alpha-blended column on the left,
         width (zero or more) opaque pixels, and one alpha-blended column
index 265ae6b..8bb4b4f 100644 (file)
@@ -47,7 +47,7 @@ void SkBlitter::blitV(int x, int y, int height, SkAlpha alpha) {
 }
 
 void SkBlitter::blitRect(int x, int y, int width, int height) {
-    SkASSERT(width >= 0);
+    SkASSERT(width > 0);
     while (--height >= 0) {
         this->blitH(x, y++, width);
     }
@@ -59,7 +59,7 @@ void SkBlitter::blitRect(int x, int y, int width, int height) {
 void SkBlitter::blitAntiRect(int x, int y, int width, int height,
                              SkAlpha leftAlpha, SkAlpha rightAlpha) {
     this->blitV(x++, y, height, leftAlpha);
-    if (width >= 0) {
+    if (width > 0) {
         this->blitRect(x, y, width, height);
         x += width;
     }