OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 void paintSkBitmap(PlatformContextSkia* platformContext, | 238 void paintSkBitmap(PlatformContextSkia* platformContext, |
239 const NativeImageSkia& bitmap, | 239 const NativeImageSkia& bitmap, |
240 const SkIRect& srcRect, | 240 const SkIRect& srcRect, |
241 const SkRect& destRect, | 241 const SkRect& destRect, |
242 const SkPorterDuff::Mode& compOp) | 242 const SkPorterDuff::Mode& compOp) |
243 { | 243 { |
244 SkPaint paint; | 244 SkPaint paint; |
245 paint.setPorterDuffXfermode(compOp); | 245 paint.setPorterDuffXfermode(compOp); |
246 | 246 |
247 gfx::PlatformCanvas* canvas = platformContext->canvas(); | 247 skia::PlatformCanvas* canvas = platformContext->canvas(); |
248 | 248 |
249 ResamplingMode resampling = platformContext->IsPrinting() ? RESAMPLE_NONE : | 249 ResamplingMode resampling = platformContext->IsPrinting() ? RESAMPLE_NONE : |
250 computeResamplingMode(bitmap, srcRect.width(), srcRect.height(), | 250 computeResamplingMode(bitmap, srcRect.width(), srcRect.height(), |
251 SkScalarToFloat(destRect.width()), | 251 SkScalarToFloat(destRect.width()), |
252 SkScalarToFloat(destRect.height())); | 252 SkScalarToFloat(destRect.height())); |
253 if (resampling == RESAMPLE_AWESOME) { | 253 if (resampling == RESAMPLE_AWESOME) { |
254 paint.setFilterBitmap(false); | 254 paint.setFilterBitmap(false); |
255 drawResampledBitmap(*canvas, paint, bitmap, srcRect, destRect); | 255 drawResampledBitmap(*canvas, paint, bitmap, srcRect, destRect); |
256 } else { | 256 } else { |
257 // No resampling necessary, we can just draw the bitmap. We want to | 257 // No resampling necessary, we can just draw the bitmap. We want to |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create( | 447 PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create( |
448 const SkBitmap& bitmap) | 448 const SkBitmap& bitmap) |
449 { | 449 { |
450 RefPtr<BitmapImageSingleFrameSkia> image(new BitmapImageSingleFrameSkia()); | 450 RefPtr<BitmapImageSingleFrameSkia> image(new BitmapImageSingleFrameSkia()); |
451 if (!bitmap.copyTo(&image->m_nativeImage, bitmap.config())) | 451 if (!bitmap.copyTo(&image->m_nativeImage, bitmap.config())) |
452 return 0; | 452 return 0; |
453 return image.release(); | 453 return image.release(); |
454 } | 454 } |
455 | 455 |
456 } // namespace WebCore | 456 } // namespace WebCore |
OLD | NEW |