Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(34)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Unified Diff: src/core/SkBlitRow_D32.cpp

Issue 5758043: Blend alpha correctly for ARGB32, ARGB16 (4444), and A8 modes. Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: don't include 5752045 in this CL Created 13 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/core/SkBlitRow.h ('K') | « include/core/SkColorPriv.h ('k') | src/core/SkBlitRow_D4444.cpp » ('j') | src/core/SkBlitter_ARGB32.cpp » ('J')
('e') | ('c') | ('s')
Index: src/core/SkBlitRow_D32.cpp
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp
index 97aa665cb951fcddbcb55253717950f25f8e5b31..89b2c5dc002da911b10ac65aac2feac8d9308b89 100644
--- a/src/core/SkBlitRow_D32.cpp
+++ b/src/core/SkBlitRow_D32.cpp
@@ -10,6 +10,8 @@
#include "SkColorPriv.h"
#include "SkUtils.h"
+static bool gUsePlatformOptsForFactory = false;
+
#define UNROLL
static void S32_Opaque_BlitRow32(SkPMColor* SK_RESTRICT dst,
@@ -24,8 +26,12 @@ static void S32_Blend_BlitRow32(SkPMColor* SK_RESTRICT dst,
int count, U8CPU alpha) {
SkASSERT(alpha <= 255);
if (count > 0) {
- unsigned src_scale = SkAlpha255To256(alpha);
+ unsigned src_scale = SkAlphaToScale(alpha);
+#ifdef SK_BLEND_CORRECTLY
+ unsigned dst_scale = SkAlphaToInvScale8(alpha);
+#else
unsigned dst_scale = 256 - src_scale;
+#endif
#ifdef UNROLL
if (count & 1) {
@@ -138,7 +144,7 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) {
flags &= kFlags32_Mask;
SkBlitRow::Proc32 proc = PlatformProcs32(flags);
- if (NULL == proc) {
+ if (NULL == proc || !gUsePlatformOptsForFactory) {
proc = gDefault_Procs32[flags];
}
SkASSERT(proc);
@@ -147,13 +153,18 @@ SkBlitRow::Proc32 SkBlitRow::Factory32(unsigned flags) {
SkBlitRow::Proc32 SkBlitRow::ColorProcFactory() {
SkBlitRow::ColorProc proc = PlatformColorProc();
- if (NULL == proc) {
+ if (NULL == proc || !gUsePlatformOptsForFactory) {
proc = Color32;
}
SkASSERT(proc);
return proc;
}
+void SkBlitRow::UsePlatformOptsForFactory(bool opts)
+{
+ gUsePlatformOptsForFactory = opts;
+}
+
void SkBlitRow::Color32(SkPMColor* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src,
int count, SkPMColor color) {
@@ -168,7 +179,11 @@ void SkBlitRow::Color32(SkPMColor* SK_RESTRICT dst,
if (255 == colorA) {
sk_memset32(dst, color, count);
} else {
+#ifdef SK_BLEND_CORRECTLY
+ unsigned scale = SkAlphaToInvScale8(colorA);
+#else
unsigned scale = 256 - SkAlpha255To256(colorA);
+#endif
do {
*dst = color + SkAlphaMulQ(*src, scale);
src += 1;
« include/core/SkBlitRow.h ('K') | « include/core/SkColorPriv.h ('k') | src/core/SkBlitRow_D4444.cpp » ('j') | src/core/SkBlitter_ARGB32.cpp » ('J')
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /