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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp

Issue 2846843002: [blink] Unique pointers in Platform.h (Closed)
Patch Set: fix compilation (and again) Created 3 years, 7 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
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return false; 235 return false;
236 236
237 DCHECK(texture_image->isTextureBacked()); // The isAccelerated() check above 237 DCHECK(texture_image->isTextureBacked()); // The isAccelerated() check above
238 // should guarantee this. 238 // should guarantee this.
239 // Get the texture ID, flushing pending operations if needed. 239 // Get the texture ID, flushing pending operations if needed.
240 const GrGLTextureInfo* texture_info = skia::GrBackendObjectToGrGLTextureInfo( 240 const GrGLTextureInfo* texture_info = skia::GrBackendObjectToGrGLTextureInfo(
241 texture_image->getTextureHandle(true)); 241 texture_image->getTextureHandle(true));
242 if (!texture_info || !texture_info->fID) 242 if (!texture_info || !texture_info->fID)
243 return false; 243 return false;
244 244
245 std::unique_ptr<WebGraphicsContext3DProvider> provider = WTF::WrapUnique( 245 std::unique_ptr<WebGraphicsContext3DProvider> provider =
246 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider()); 246 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider();
247 if (!provider || !provider->GetGrContext()) 247 if (!provider || !provider->GetGrContext())
248 return false; 248 return false;
249 gpu::gles2::GLES2Interface* shared_gl = provider->ContextGL(); 249 gpu::gles2::GLES2Interface* shared_gl = provider->ContextGL();
250 250
251 gpu::Mailbox mailbox; 251 gpu::Mailbox mailbox;
252 252
253 // Contexts may be in a different share group. We must transfer the texture 253 // Contexts may be in a different share group. We must transfer the texture
254 // through a mailbox first. 254 // through a mailbox first.
255 shared_gl->GenMailboxCHROMIUM(mailbox.name); 255 shared_gl->GenMailboxCHROMIUM(mailbox.name);
256 shared_gl->ProduceTextureDirectCHROMIUM(texture_info->fID, 256 shared_gl->ProduceTextureDirectCHROMIUM(texture_info->fID,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 gr_context->resetContext(kTextureBinding_GrGLBackendState); 298 gr_context->resetContext(kTextureBinding_GrGLBackendState);
299 299
300 return true; 300 return true;
301 } 301 }
302 302
303 bool ImageBuffer::CopyRenderingResultsFromDrawingBuffer( 303 bool ImageBuffer::CopyRenderingResultsFromDrawingBuffer(
304 DrawingBuffer* drawing_buffer, 304 DrawingBuffer* drawing_buffer,
305 SourceDrawingBuffer source_buffer) { 305 SourceDrawingBuffer source_buffer) {
306 if (!drawing_buffer || !surface_->IsAccelerated()) 306 if (!drawing_buffer || !surface_->IsAccelerated())
307 return false; 307 return false;
308 std::unique_ptr<WebGraphicsContext3DProvider> provider = WTF::WrapUnique( 308 std::unique_ptr<WebGraphicsContext3DProvider> provider =
309 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider()); 309 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider();
310 if (!provider) 310 if (!provider)
311 return false; 311 return false;
312 gpu::gles2::GLES2Interface* gl = provider->ContextGL(); 312 gpu::gles2::GLES2Interface* gl = provider->ContextGL();
313 GLuint texture_id = surface_->GetBackingTextureHandleForOverwrite(); 313 GLuint texture_id = surface_->GetBackingTextureHandleForOverwrite();
314 if (!texture_id) 314 if (!texture_id)
315 return false; 315 return false;
316 316
317 gl->Flush(); 317 gl->Flush();
318 318
319 return drawing_buffer->CopyToPlatformTexture( 319 return drawing_buffer->CopyToPlatformTexture(
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type)); 566 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type));
567 567
568 Vector<unsigned char> result; 568 Vector<unsigned char> result;
569 if (!EncodeImage(mime_type, quality, &result)) 569 if (!EncodeImage(mime_type, quality, &result))
570 return "data:,"; 570 return "data:,";
571 571
572 return "data:" + mime_type + ";base64," + Base64Encode(result); 572 return "data:" + mime_type + ";base64," + Base64Encode(result);
573 } 573 }
574 574
575 } // namespace blink 575 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698