Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | #include "precompiled.h" |
michael@0 | 2 | // |
michael@0 | 3 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
michael@0 | 4 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | // found in the LICENSE file. |
michael@0 | 6 | // |
michael@0 | 7 | |
michael@0 | 8 | // RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9 |
michael@0 | 9 | // pointers retained by renderbuffers. |
michael@0 | 10 | |
michael@0 | 11 | #include "libGLESv2/renderer/RenderTarget9.h" |
michael@0 | 12 | #include "libGLESv2/renderer/Renderer9.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "libGLESv2/renderer/renderer9_utils.h" |
michael@0 | 15 | #include "libGLESv2/main.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace rx |
michael@0 | 18 | { |
michael@0 | 19 | |
michael@0 | 20 | RenderTarget9::RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface) |
michael@0 | 21 | { |
michael@0 | 22 | mRenderer = Renderer9::makeRenderer9(renderer); |
michael@0 | 23 | mRenderTarget = surface; |
michael@0 | 24 | |
michael@0 | 25 | if (mRenderTarget) |
michael@0 | 26 | { |
michael@0 | 27 | D3DSURFACE_DESC description; |
michael@0 | 28 | mRenderTarget->GetDesc(&description); |
michael@0 | 29 | |
michael@0 | 30 | mWidth = description.Width; |
michael@0 | 31 | mHeight = description.Height; |
michael@0 | 32 | |
michael@0 | 33 | mInternalFormat = d3d9_gl::GetEquivalentFormat(description.Format); |
michael@0 | 34 | mActualFormat = d3d9_gl::GetEquivalentFormat(description.Format); |
michael@0 | 35 | mSamples = d3d9_gl::GetSamplesFromMultisampleType(description.MultiSampleType); |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | RenderTarget9::RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples) |
michael@0 | 40 | { |
michael@0 | 41 | mRenderer = Renderer9::makeRenderer9(renderer); |
michael@0 | 42 | mRenderTarget = NULL; |
michael@0 | 43 | |
michael@0 | 44 | D3DFORMAT requestedFormat = gl_d3d9::ConvertRenderbufferFormat(format); |
michael@0 | 45 | int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples); |
michael@0 | 46 | |
michael@0 | 47 | if (supportedSamples == -1) |
michael@0 | 48 | { |
michael@0 | 49 | gl::error(GL_OUT_OF_MEMORY); |
michael@0 | 50 | |
michael@0 | 51 | return; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | HRESULT result = D3DERR_INVALIDCALL; |
michael@0 | 55 | |
michael@0 | 56 | if (width > 0 && height > 0) |
michael@0 | 57 | { |
michael@0 | 58 | if (requestedFormat == D3DFMT_D24S8) |
michael@0 | 59 | { |
michael@0 | 60 | result = mRenderer->getDevice()->CreateDepthStencilSurface(width, height, requestedFormat, |
michael@0 | 61 | gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples), |
michael@0 | 62 | 0, FALSE, &mRenderTarget, NULL); |
michael@0 | 63 | } |
michael@0 | 64 | else |
michael@0 | 65 | { |
michael@0 | 66 | result = mRenderer->getDevice()->CreateRenderTarget(width, height, requestedFormat, |
michael@0 | 67 | gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples), |
michael@0 | 68 | 0, FALSE, &mRenderTarget, NULL); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY) |
michael@0 | 72 | { |
michael@0 | 73 | gl::error(GL_OUT_OF_MEMORY); |
michael@0 | 74 | |
michael@0 | 75 | return; |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | ASSERT(SUCCEEDED(result)); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | mWidth = width; |
michael@0 | 82 | mHeight = height; |
michael@0 | 83 | mInternalFormat = format; |
michael@0 | 84 | mSamples = supportedSamples; |
michael@0 | 85 | mActualFormat = d3d9_gl::GetEquivalentFormat(requestedFormat); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | RenderTarget9::~RenderTarget9() |
michael@0 | 89 | { |
michael@0 | 90 | if (mRenderTarget) |
michael@0 | 91 | { |
michael@0 | 92 | mRenderTarget->Release(); |
michael@0 | 93 | } |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | RenderTarget9 *RenderTarget9::makeRenderTarget9(RenderTarget *target) |
michael@0 | 97 | { |
michael@0 | 98 | ASSERT(HAS_DYNAMIC_TYPE(rx::RenderTarget9*, target)); |
michael@0 | 99 | return static_cast<rx::RenderTarget9*>(target); |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | IDirect3DSurface9 *RenderTarget9::getSurface() |
michael@0 | 103 | { |
michael@0 | 104 | // Caller is responsible for releasing the returned surface reference. |
michael@0 | 105 | if (mRenderTarget) |
michael@0 | 106 | { |
michael@0 | 107 | mRenderTarget->AddRef(); |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | return mRenderTarget; |
michael@0 | 111 | } |
michael@0 | 112 | |
michael@0 | 113 | } |