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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/platform/graphics/skia/NativeImageSkia.h" | 32 #include "core/platform/graphics/skia/NativeImageSkia.h" |
33 | 33 |
| 34 #include "core/platform/FloatConversion.h" |
34 #include "core/platform/PlatformInstrumentation.h" | 35 #include "core/platform/PlatformInstrumentation.h" |
35 #include "core/platform/chromium/TraceEvent.h" | 36 #include "core/platform/chromium/TraceEvent.h" |
36 #include "core/platform/graphics/FloatPoint.h" | 37 #include "core/platform/graphics/FloatPoint.h" |
37 #include "core/platform/graphics/FloatRect.h" | 38 #include "core/platform/graphics/FloatRect.h" |
38 #include "core/platform/graphics/FloatSize.h" | 39 #include "core/platform/graphics/FloatSize.h" |
39 #include "core/platform/graphics/GraphicsContext.h" | 40 #include "core/platform/graphics/GraphicsContext.h" |
40 #include "core/platform/graphics/Image.h" | 41 #include "core/platform/graphics/Image.h" |
41 #include "core/platform/graphics/chromium/DeferredImageDecoder.h" | 42 #include "core/platform/graphics/chromium/DeferredImageDecoder.h" |
42 #include "core/platform/graphics/skia/SkiaUtils.h" | 43 #include "core/platform/graphics/skia/SkiaUtils.h" |
43 #include "skia/ext/image_operations.h" | 44 #include "skia/ext/image_operations.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 { | 320 { |
320 return !context->getTotalMatrix().rectStaysRect(); | 321 return !context->getTotalMatrix().rectStaysRect(); |
321 } | 322 } |
322 | 323 |
323 void NativeImageSkia::draw(GraphicsContext* context, const SkRect& srcRect, cons
t SkRect& destRect, SkXfermode::Mode compOp) const | 324 void NativeImageSkia::draw(GraphicsContext* context, const SkRect& srcRect, cons
t SkRect& destRect, SkXfermode::Mode compOp) const |
324 { | 325 { |
325 TRACE_EVENT0("skia", "NativeImageSkia::draw"); | 326 TRACE_EVENT0("skia", "NativeImageSkia::draw"); |
326 SkPaint paint; | 327 SkPaint paint; |
327 paint.setXfermodeMode(compOp); | 328 paint.setXfermodeMode(compOp); |
328 paint.setAlpha(context->getNormalizedAlpha()); | 329 paint.setAlpha(context->getNormalizedAlpha()); |
329 paint.setLooper(context->drawLooper()); | 330 DrawLooper* drawLooper = context->drawLooper(); |
| 331 if (drawLooper) { |
| 332 if (drawLooper->shouldUseImageFilterToDrawBitmap(bitmap())) { |
| 333 paint.setImageFilter(context->drawLooper()->imageFilter()); |
| 334 } else { |
| 335 paint.setLooper(drawLooper->skDrawLooper()); |
| 336 } |
| 337 } |
330 // only antialias if we're rotated or skewed | 338 // only antialias if we're rotated or skewed |
331 paint.setAntiAlias(hasNon90rotation(context)); | 339 paint.setAntiAlias(hasNon90rotation(context)); |
332 | 340 |
333 ResamplingMode resampling; | 341 ResamplingMode resampling; |
334 if (context->isAccelerated()) { | 342 if (context->isAccelerated()) { |
335 resampling = LinearResampling; | 343 resampling = LinearResampling; |
336 } else if (context->printing()) { | 344 } else if (context->printing()) { |
337 resampling = NoResampling; | 345 resampling = NoResampling; |
338 } else { | 346 } else { |
339 // Take into account scale applied to the canvas when computing sampling
mode (e.g. CSS scale or page scale). | 347 // Take into account scale applied to the canvas when computing sampling
mode (e.g. CSS scale or page scale). |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) | 544 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) |
537 { | 545 { |
538 if (!scaledImageSubset.contains(otherScaledImageSubset)) | 546 if (!scaledImageSubset.contains(otherScaledImageSubset)) |
539 return SkIRect::MakeEmpty(); | 547 return SkIRect::MakeEmpty(); |
540 SkIRect subsetRect = otherScaledImageSubset; | 548 SkIRect subsetRect = otherScaledImageSubset; |
541 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); | 549 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); |
542 return subsetRect; | 550 return subsetRect; |
543 } | 551 } |
544 | 552 |
545 } // namespace WebCore | 553 } // namespace WebCore |
OLD | NEW |