http://codereview.appspot.com/3980041/
Add blitmask procs (with optional platform acceleration)
patch by yaojie.yan
git-svn-id: http://skia.googlecode.com/svn/trunk@910 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp
index fa7b17a..749117a 100644
--- a/src/opts/opts_check_SSE2.cpp
+++ b/src/opts/opts_check_SSE2.cpp
@@ -2,16 +2,16 @@
**
** Copyright 2009, The Android Open Source Project
**
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
**
- ** http://www.apache.org/licenses/LICENSE-2.0
+ ** http://www.apache.org/licenses/LICENSE-2.0
**
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -105,6 +105,27 @@
}
}
+
+SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
+ SkColor color)
+{
+
+ SkBlitMask::Proc proc = NULL;
+ if (hasSSE2()) {
+ switch (dstConfig) {
+ case SkBitmap::kARGB_8888_Config:
+ // TODO: is our current SSE2 faster than the portable, even in
+ // the case of black or opaque? If so, no need for this check.
+ if ( SK_ColorBLACK != color && 0xFF != SkColorGetA(color))
+ proc = SkARGB32_BlitMask_SSE2;
+ break;
+ default:
+ break;
+ }
+ }
+ return proc;
+}
+
SkMemset16Proc SkMemset16GetPlatformProc() {
if (hasSSE2()) {
return sk_memset16_SSE2;