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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SkIRect resizedSubsetRect = m_cachedImageInfo.rectInSubset(scaledImageSubset
); | 152 SkIRect resizedSubsetRect = m_cachedImageInfo.rectInSubset(scaledImageSubset
); |
153 m_resizedImage.extractSubset(&resizedSubset, resizedSubsetRect); | 153 m_resizedImage.extractSubset(&resizedSubset, resizedSubsetRect); |
154 return resizedSubset; | 154 return resizedSubset; |
155 } | 155 } |
156 | 156 |
157 void NativeImageSkia::draw( | 157 void NativeImageSkia::draw( |
158 GraphicsContext* context, | 158 GraphicsContext* context, |
159 const SkRect& srcRect, | 159 const SkRect& srcRect, |
160 const SkRect& destRect, | 160 const SkRect& destRect, |
161 CompositeOperator compositeOp, | 161 CompositeOperator compositeOp, |
162 blink::WebBlendMode blendMode) const | 162 WebBlendMode blendMode) const |
163 { | 163 { |
164 TRACE_EVENT0("skia", "NativeImageSkia::draw"); | 164 TRACE_EVENT0("skia", "NativeImageSkia::draw"); |
165 | 165 |
166 bool isLazyDecoded = DeferredImageDecoder::isLazyDecoded(bitmap()); | 166 bool isLazyDecoded = DeferredImageDecoder::isLazyDecoded(bitmap()); |
167 | 167 |
168 SkPaint paint; | 168 SkPaint paint; |
169 context->preparePaintForDrawRectToRect(&paint, srcRect, destRect, compositeO
p, blendMode, isLazyDecoded, isDataComplete()); | 169 context->preparePaintForDrawRectToRect(&paint, srcRect, destRect, compositeO
p, blendMode, isLazyDecoded, isDataComplete()); |
170 // We want to filter it if we decided to do interpolation above, or if | 170 // We want to filter it if we decided to do interpolation above, or if |
171 // there is something interesting going on with the matrix (like a rotation)
. | 171 // there is something interesting going on with the matrix (like a rotation)
. |
172 // Note: for serialization, we will want to subset the bitmap first so we | 172 // Note: for serialization, we will want to subset the bitmap first so we |
(...skipping 20 matching lines...) Expand all Loading... |
193 return result; | 193 return result; |
194 } | 194 } |
195 | 195 |
196 void NativeImageSkia::drawPattern( | 196 void NativeImageSkia::drawPattern( |
197 GraphicsContext* context, | 197 GraphicsContext* context, |
198 const FloatRect& floatSrcRect, | 198 const FloatRect& floatSrcRect, |
199 const FloatSize& scale, | 199 const FloatSize& scale, |
200 const FloatPoint& phase, | 200 const FloatPoint& phase, |
201 CompositeOperator compositeOp, | 201 CompositeOperator compositeOp, |
202 const FloatRect& destRect, | 202 const FloatRect& destRect, |
203 blink::WebBlendMode blendMode, | 203 WebBlendMode blendMode, |
204 const IntSize& repeatSpacing) const | 204 const IntSize& repeatSpacing) const |
205 { | 205 { |
206 FloatRect normSrcRect = floatSrcRect; | 206 FloatRect normSrcRect = floatSrcRect; |
207 normSrcRect.intersect(FloatRect(0, 0, bitmap().width(), bitmap().height())); | 207 normSrcRect.intersect(FloatRect(0, 0, bitmap().width(), bitmap().height())); |
208 if (destRect.isEmpty() || normSrcRect.isEmpty()) | 208 if (destRect.isEmpty() || normSrcRect.isEmpty()) |
209 return; // nothing to draw | 209 return; // nothing to draw |
210 | 210 |
211 SkMatrix totalMatrix = context->getTotalMatrix(); | 211 SkMatrix totalMatrix = context->getTotalMatrix(); |
212 AffineTransform ctm = context->getCTM(); | 212 AffineTransform ctm = context->getCTM(); |
213 SkScalar ctmScaleX = ctm.xScale(); | 213 SkScalar ctmScaleX = ctm.xScale(); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) | 371 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) |
372 { | 372 { |
373 if (!scaledImageSubset.contains(otherScaledImageSubset)) | 373 if (!scaledImageSubset.contains(otherScaledImageSubset)) |
374 return SkIRect::MakeEmpty(); | 374 return SkIRect::MakeEmpty(); |
375 SkIRect subsetRect = otherScaledImageSubset; | 375 SkIRect subsetRect = otherScaledImageSubset; |
376 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); | 376 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); |
377 return subsetRect; | 377 return subsetRect; |
378 } | 378 } |
379 | 379 |
380 } // namespace blink | 380 } // namespace blink |
OLD | NEW |