From a31ac73b8e261f02c4bd6ae1d622c4bd00226b80 Mon Sep 17 00:00:00 2001 From: "tomhudson@google.com" Date: Thu, 29 Dec 2011 16:09:31 +0000 Subject: [PATCH] Tighten up restrictions on blit width: some shaders assert that they 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 | 4 ++-- src/core/SkBlitter.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/core/SkBlitter.h b/include/core/SkBlitter.h index e784ef5..ce74a28 100644 --- a/include/core/SkBlitter.h +++ b/include/core/SkBlitter.h @@ -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 diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index 265ae6b..8bb4b4f 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -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; } -- 2.7.4