OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // need it to, we copy the image. | 290 // need it to, we copy the image. |
291 bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config)
; | 291 bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config)
; |
292 } else { | 292 } else { |
293 // If there is a pixel ref, we can safely use the assignment operator. | 293 // If there is a pixel ref, we can safely use the assignment operator. |
294 m_state->m_imageBufferClip = *bitmap; | 294 m_state->m_imageBufferClip = *bitmap; |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath) | 298 void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath) |
299 { | 299 { |
| 300 if (m_canvas->getTopDevice()->getDeviceCapabilities() & SkDevice::kVector_Ca
pability) { |
| 301 // When the output is a vector device, like PDF, we don't need antialias
ed clips. |
| 302 // It's up to the PDF rendering engine to do that. We can simply disable
the |
| 303 // antialiased clip code if the output is a vector device. |
| 304 canvas()->clipPath(clipPath); |
| 305 return; |
| 306 } |
| 307 |
300 // If we are currently tracking any anti-alias clip paths, then we already | 308 // If we are currently tracking any anti-alias clip paths, then we already |
301 // have a layer in place and don't need to add another. | 309 // have a layer in place and don't need to add another. |
302 bool haveLayerOutstanding = m_state->m_antiAliasClipPaths.size(); | 310 bool haveLayerOutstanding = m_state->m_antiAliasClipPaths.size(); |
303 | 311 |
304 // See comments in applyAntiAliasedClipPaths about how this works. | 312 // See comments in applyAntiAliasedClipPaths about how this works. |
305 m_state->m_antiAliasClipPaths.append(clipPath); | 313 m_state->m_antiAliasClipPaths.append(clipPath); |
306 | 314 |
307 if (!haveLayerOutstanding) { | 315 if (!haveLayerOutstanding) { |
308 SkRect bounds = clipPath.getBounds(); | 316 SkRect bounds = clipPath.getBounds(); |
309 canvas()->saveLayerAlpha(&bounds, 255, static_cast<SkCanvas::SaveFlags>(
SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag | SkCanva
s::kClipToLayer_SaveFlag)); | 317 canvas()->saveLayerAlpha(&bounds, 255, static_cast<SkCanvas::SaveFlags>(
SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag | SkCanva
s::kClipToLayer_SaveFlag)); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 // Swizzles from RGBA -> BGRA. | 910 // Swizzles from RGBA -> BGRA. |
903 pixels[i] = (pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16)
| ((pixel & 0x000000FF) << 16); | 911 pixels[i] = (pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16)
| ((pixel & 0x000000FF) << 16); |
904 } | 912 } |
905 } | 913 } |
906 } | 914 } |
907 m_softwareDirtyRect.unite(IntRect(0, 0, width, height)); // Mark everything
as dirty. | 915 m_softwareDirtyRect.unite(IntRect(0, 0, width, height)); // Mark everything
as dirty. |
908 #endif | 916 #endif |
909 } | 917 } |
910 | 918 |
911 } // namespace WebCore | 919 } // namespace WebCore |
OLD | NEW |