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

Side by Side Diff: Source/core/platform/graphics/ImageBuffer.cpp

Issue 93873009: Moved GL enums from GraphicsContext3D to a more generic location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed unneeded include Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (!extensions->supports("GL_CHROMIUM_copy_texture") || !extensions->suppor ts("GL_CHROMIUM_flipy") 269 if (!extensions->supports("GL_CHROMIUM_copy_texture") || !extensions->suppor ts("GL_CHROMIUM_flipy")
270 || !extensions->canUseCopyTextureCHROMIUM(internalFormat, destType, leve l)) 270 || !extensions->canUseCopyTextureCHROMIUM(internalFormat, destType, leve l))
271 return false; 271 return false;
272 272
273 // The canvas is stored in a premultiplied format, so unpremultiply if neces sary. 273 // The canvas is stored in a premultiplied format, so unpremultiply if neces sary.
274 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !prem ultiplyAlpha); 274 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !prem ultiplyAlpha);
275 275
276 // The canvas is stored in an inverted position, so the flip semantics are r eversed. 276 // The canvas is stored in an inverted position, so the flip semantics are r eversed.
277 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, !flipY); 277 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, !flipY);
278 278
279 extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, sourceTexture , texture, level, internalFormat, destType); 279 extensions->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level , internalFormat, destType);
280 280
281 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, false); 281 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, false);
282 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false ); 282 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false );
283 context.flush(); 283 context.flush();
284 return true; 284 return true;
285 } 285 }
286 286
287 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst) 287 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst)
288 { 288 {
289 return (src == dst); 289 return (src == dst);
(...skipping 11 matching lines...) Expand all
301 301
302 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu ffer) 302 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu ffer)
303 { 303 {
304 if (!drawingBuffer) 304 if (!drawingBuffer)
305 return false; 305 return false;
306 RefPtr<GraphicsContext3D> context3D = SharedGraphicsContext3D::get(); 306 RefPtr<GraphicsContext3D> context3D = SharedGraphicsContext3D::get();
307 Platform3DObject tex = getBackingTexture(); 307 Platform3DObject tex = getBackingTexture();
308 if (!context3D || !tex) 308 if (!context3D || !tex)
309 return false; 309 return false;
310 310
311 return drawingBuffer->copyToPlatformTexture(*(context3D.get()), tex, Graphic sContext3D::RGBA, 311 return drawingBuffer->copyToPlatformTexture(*(context3D.get()), tex, GL_RGBA ,
312 GraphicsContext3D::UNSIGNED_BYTE, 0, true, false); 312 GL_UNSIGNED_BYTE, 0, true, false);
313 } 313 }
314 314
315 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect& srcRect, 315 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect& srcRect,
316 CompositeOperator op, blink::WebBlendMode blendMode, bool useLowQualityScale ) 316 CompositeOperator op, blink::WebBlendMode blendMode, bool useLowQualityScale )
317 { 317 {
318 if (!isValid()) 318 if (!isValid())
319 return; 319 return;
320 320
321 const SkBitmap& bitmap = *m_context->bitmap(); 321 const SkBitmap& bitmap = *m_context->bitmap();
322 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); 322 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap));
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 559 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
560 return "data:,"; 560 return "data:,";
561 561
562 Vector<char> base64Data; 562 Vector<char> base64Data;
563 base64Encode(encodedImage, base64Data); 563 base64Encode(encodedImage, base64Data);
564 564
565 return "data:" + mimeType + ";base64," + base64Data; 565 return "data:" + mimeType + ";base64," + base64Data;
566 } 566 }
567 567
568 } // namespace WebCore 568 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698