OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 static SkCanvas* createAcceleratedCanvas(const IntSize& size, ImageBufferData* d
ata, DeferralMode deferralMode) | 74 static SkCanvas* createAcceleratedCanvas(const IntSize& size, ImageBufferData* d
ata, DeferralMode deferralMode) |
75 { | 75 { |
76 RefPtr<GraphicsContext3D> context3D = SharedGraphicsContext3D::get(); | 76 RefPtr<GraphicsContext3D> context3D = SharedGraphicsContext3D::get(); |
77 if (!context3D) | 77 if (!context3D) |
78 return 0; | 78 return 0; |
79 GrContext* gr = context3D->grContext(); | 79 GrContext* gr = context3D->grContext(); |
80 if (!gr) | 80 if (!gr) |
81 return 0; | 81 return 0; |
82 context3D->getExtensions()->pushGroupMarkerEXT("AcceleratedCanvasContext"); | |
83 gr->resetContext(); | 82 gr->resetContext(); |
84 GrTextureDesc desc; | 83 GrTextureDesc desc; |
85 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 84 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
86 desc.fSampleCnt = 0; | 85 desc.fSampleCnt = 0; |
87 desc.fWidth = size.width(); | 86 desc.fWidth = size.width(); |
88 desc.fHeight = size.height(); | 87 desc.fHeight = size.height(); |
89 desc.fConfig = kSkia8888_GrPixelConfig; | 88 desc.fConfig = kSkia8888_GrPixelConfig; |
90 SkAutoTUnref<GrTexture> texture(gr->createUncachedTexture(desc, 0, 0)); | 89 SkAutoTUnref<GrTexture> texture(gr->createUncachedTexture(desc, 0, 0)); |
91 if (!texture.get()) | 90 if (!texture.get()) |
92 return 0; | 91 return 0; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 391 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
393 return "data:,"; | 392 return "data:,"; |
394 | 393 |
395 Vector<char> base64Data; | 394 Vector<char> base64Data; |
396 base64Encode(encodedImage, base64Data); | 395 base64Encode(encodedImage, base64Data); |
397 | 396 |
398 return "data:" + mimeType + ";base64," + base64Data; | 397 return "data:" + mimeType + ";base64," + base64Data; |
399 } | 398 } |
400 | 399 |
401 } // namespace WebCore | 400 } // namespace WebCore |
OLD | NEW |