OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount = 0) | 52 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount = 0) |
53 { | 53 { |
54 if (!gr) | 54 if (!gr) |
55 return nullptr; | 55 return nullptr; |
56 gr->resetContext(); | 56 gr->resetContext(); |
57 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 57 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
58 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount)); | 58 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
| 59 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount, &disa
bleLCDProps)); |
59 } | 60 } |
60 | 61 |
61 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) | 62 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) |
62 { | 63 { |
63 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); | 64 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); |
64 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); | 65 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); |
65 if (!contextProvider) | 66 if (!contextProvider) |
66 return nullptr; | 67 return nullptr; |
67 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount)); | 68 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount)); |
68 if (!surface) | 69 if (!surface) |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // This copy constructor should only be used for Vector reallocation | 565 // This copy constructor should only be used for Vector reallocation |
565 // Assuming 'other' is to be destroyed, we transfer m_image and | 566 // Assuming 'other' is to be destroyed, we transfer m_image and |
566 // m_parentLayerBridge ownership rather than do a refcount dance. | 567 // m_parentLayerBridge ownership rather than do a refcount dance. |
567 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
568 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
569 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
570 m_status = other.m_status; | 571 m_status = other.m_status; |
571 } | 572 } |
572 | 573 |
573 } // namespace blink | 574 } // namespace blink |
OLD | NEW |