Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/platform/graphics/Image.cpp

Issue 476683002: Cleanup namespace usage in platform/graphics/[G-S]* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/graphics/Image.h ('k') | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 Image* Image::nullImage() 58 Image* Image::nullImage()
59 { 59 {
60 ASSERT(isMainThread()); 60 ASSERT(isMainThread());
61 DEFINE_STATIC_REF(Image, nullImage, (BitmapImage::create())); 61 DEFINE_STATIC_REF(Image, nullImage, (BitmapImage::create()));
62 return nullImage; 62 return nullImage;
63 } 63 }
64 64
65 PassRefPtr<Image> Image::loadPlatformResource(const char *name) 65 PassRefPtr<Image> Image::loadPlatformResource(const char *name)
66 { 66 {
67 const blink::WebData& resource = blink::Platform::current()->loadResource(na me); 67 const WebData& resource = Platform::current()->loadResource(name);
68 if (resource.isEmpty()) 68 if (resource.isEmpty())
69 return Image::nullImage(); 69 return Image::nullImage();
70 70
71 RefPtr<Image> image = BitmapImage::create(); 71 RefPtr<Image> image = BitmapImage::create();
72 image->setData(resource, true); 72 image->setData(resource, true);
73 return image.release(); 73 return image.release();
74 } 74 }
75 75
76 bool Image::supportsType(const String& type) 76 bool Image::supportsType(const String& type)
77 { 77 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 norm.setX(norm.x() + norm.width()); 109 norm.setX(norm.x() + norm.width());
110 norm.setWidth(-norm.width()); 110 norm.setWidth(-norm.width());
111 } 111 }
112 if (norm.height() < 0) { 112 if (norm.height() < 0) {
113 norm.setY(norm.y() + norm.height()); 113 norm.setY(norm.y() + norm.height());
114 norm.setHeight(-norm.height()); 114 norm.setHeight(-norm.height());
115 } 115 }
116 return norm; 116 return norm;
117 } 117 }
118 118
119 void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect & srcRect, CompositeOperator op, blink::WebBlendMode blendMode, RespectImageOrie ntationEnum) 119 void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect & srcRect, CompositeOperator op, WebBlendMode blendMode, RespectImageOrientation Enum)
120 { 120 {
121 draw(ctx, dstRect, srcRect, op, blendMode); 121 draw(ctx, dstRect, srcRect, op, blendMode);
122 } 122 }
123 123
124 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op, blink ::WebBlendMode blendMode, const IntSize& repeatSpacing) 124 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op, WebBl endMode blendMode, const IntSize& repeatSpacing)
125 { 125 {
126 if (mayFillWithSolidColor()) { 126 if (mayFillWithSolidColor()) {
127 fillWithSolidColor(ctxt, destRect, solidColor(), op); 127 fillWithSolidColor(ctxt, destRect, solidColor(), op);
128 return; 128 return;
129 } 129 }
130 130
131 // See <https://webkit.org/b/59043>. 131 // See <https://webkit.org/b/59043>.
132 ASSERT(!isBitmapImage() || notSolidColor()); 132 ASSERT(!isBitmapImage() || notSolidColor());
133 133
134 FloatSize intrinsicTileSize = size(); 134 FloatSize intrinsicTileSize = size();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect); 216 drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect);
217 ctxt->setImageInterpolationQuality(previousInterpolationQuality); 217 ctxt->setImageInterpolationQuality(previousInterpolationQuality);
218 } else { 218 } else {
219 drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect); 219 drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect);
220 } 220 }
221 221
222 startAnimation(); 222 startAnimation();
223 } 223 }
224 224
225 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale, 225 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale,
226 const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& des tRect, blink::WebBlendMode blendMode, const IntSize& repeatSpacing) 226 const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& des tRect, WebBlendMode blendMode, const IntSize& repeatSpacing)
227 { 227 {
228 TRACE_EVENT0("skia", "Image::drawPattern"); 228 TRACE_EVENT0("skia", "Image::drawPattern");
229 if (RefPtr<NativeImageSkia> bitmap = nativeImageForCurrentFrame()) 229 if (RefPtr<NativeImageSkia> bitmap = nativeImageForCurrentFrame())
230 bitmap->drawPattern(context, adjustForNegativeSize(floatSrcRect), scale, phase, compositeOp, destRect, blendMode, repeatSpacing); 230 bitmap->drawPattern(context, adjustForNegativeSize(floatSrcRect), scale, phase, compositeOp, destRect, blendMode, repeatSpacing);
231 } 231 }
232 232
233 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic Height, FloatSize& intrinsicRatio) 233 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic Height, FloatSize& intrinsicRatio)
234 { 234 {
235 intrinsicRatio = size(); 235 intrinsicRatio = size();
236 intrinsicWidth = Length(intrinsicRatio.width(), Fixed); 236 intrinsicWidth = Length(intrinsicRatio.width(), Fixed);
237 intrinsicHeight = Length(intrinsicRatio.height(), Fixed); 237 intrinsicHeight = Length(intrinsicRatio.height(), Fixed);
238 } 238 }
239 239
240 PassRefPtr<Image> Image::imageForDefaultFrame() 240 PassRefPtr<Image> Image::imageForDefaultFrame()
241 { 241 {
242 RefPtr<Image> image(this); 242 RefPtr<Image> image(this);
243 243
244 return image.release(); 244 return image.release();
245 } 245 }
246 246
247 } 247 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/Image.h ('k') | Source/platform/graphics/ImageBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698