text:
namespace blink {

class CachingWordShaperTest : public testing::Test {
 protected:
  void SetUp() override {
    font_description.SetComputedSize(12.0);
    font_description.SetLocale(LayoutLocale::Get("en"));
    ASSERT_EQ(USCRIPT_LATIN, font_description.GetScript());
    font_description.SetGenericFamily(FontDescription::kStandardFamily);

    font = Font(font_description);
    ASSERT_TRUE(font.CanShapeWordByWord());
    fallback_fonts = nullptr;
    cache = std::make_unique<ShapeCache>();
  }

  base::test::TaskEnvironment task_environment_;
  FontCachePurgePreventer font_cache_purge_preventer;
  FontDescription font_description;
  Font font;
  std::unique_ptr<ShapeCache> cache;
  HashSet<const SimpleFontData*>* fallback_fonts;
  unsigned start_index = 0;
  unsigned num_glyphs = 0;
  hb_script_t script = HB_SCRIPT_INVALID;
};

static inline const ShapeResultTestInfo* TestInfo(
    scoped_refptr<const ShapeResult>& result) {
  return static_cast<const ShapeResultTestInfo*>(result.get());
}

TEST_F(CachingWordShaperTest, LatinLeftToRightByWord) {
  TextRun text_run(reinterpret_cast<const LChar*>("ABC DEF."), 8);

  scoped_refptr<const ShapeResult> result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);
  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(0u, start_index);
  EXPECT_EQ(3u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_LATIN, script);

  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(0u, start_index);
  EXPECT_EQ(1u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_COMMON, script);

  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(0u, start_index);
  EXPECT_EQ(4u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_LATIN, script);

  ASSERT_FALSE(iterator.Next(&result));
}

TEST_F(CachingWordShaperTest, CommonAccentLeftToRightByWord) {
  const UChar kStr[] = {0x2F, 0x301, 0x2E, 0x20, 0x2E, 0x0};
  TextRun text_run(kStr, 5);

  unsigned offset = 0;
  scoped_refptr<const ShapeResult> result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);
  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(0u, offset + start_index);
  EXPECT_EQ(3u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_COMMON, script);
  offset += result->NumCharacters();

  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(3u, offset + start_index);
  EXPECT_EQ(1u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_COMMON, script);
  offset += result->NumCharacters();

  ASSERT_TRUE(iterator.Next(&result));
  ASSERT_TRUE(
      TestInfo(result)->RunInfoForTesting(0, start_index, num_glyphs, script));
  EXPECT_EQ(4u, offset + start_index);
  EXPECT_EQ(1u, num_glyphs);
  EXPECT_EQ(HB_SCRIPT_COMMON, script);
  offset += result->NumCharacters();

  ASSERT_EQ(5u, offset);
  ASSERT_FALSE(iterator.Next(&result));
}

TEST_F(CachingWordShaperTest, SegmentCJKByCharacter) {
  const UChar kStr[] = {0x56FD, 0x56FD,  // CJK Unified Ideograph
                        'a',    'b',
                        0x56FD,  // CJK Unified Ideograph
                        'x',    'y',    'z',
                        0x3042,  // HIRAGANA LETTER A
                        0x56FD,  // CJK Unified Ideograph
                        0x0};
  TextRun text_run(kStr, 10);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());
  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(3u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());
  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKAndCommon) {
  const UChar kStr[] = {'a',    'b',
                        0xFF08,  // FULLWIDTH LEFT PARENTHESIS (script=common)
                        0x56FD,  // CJK Unified Ideograph
                        0x56FD,  // CJK Unified Ideograph
                        0x56FD,  // CJK Unified Ideograph
                        0x3002,  // IDEOGRAPHIC FULL STOP (script=common)
                        0x0};
  TextRun text_run(kStr, 7);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKAndInherit) {
  const UChar kStr[] = {
      0x304B,  // HIRAGANA LETTER KA
      0x304B,  // HIRAGANA LETTER KA
      0x3009,  // COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
      0x304B,  // HIRAGANA LETTER KA
      0x0};
  TextRun text_run(kStr, 4);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKAndNonCJKCommon) {
  const UChar kStr[] = {0x56FD,  // CJK Unified Ideograph
                        ' ', 0x0};
  TextRun text_run(kStr, 2);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiZWJCommon) {
  // A family followed by a couple with heart emoji sequence,
  // the latter including a variation selector.
  const UChar kStr[] = {0xD83D, 0xDC68, 0x200D, 0xD83D, 0xDC69, 0x200D,
                        0xD83D, 0xDC67, 0x200D, 0xD83D, 0xDC66, 0xD83D,
                        0xDC69, 0x200D, 0x2764, 0xFE0F, 0x200D, 0xD83D,
                        0xDC8B, 0x200D, 0xD83D, 0xDC68, 0x0};
  TextRun text_run(kStr, 22);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(22u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiPilotJudgeSequence) {
  // A family followed by a couple with heart emoji sequence,
  // the latter including a variation selector.
  const UChar kStr[] = {0xD83D, 0xDC68, 0xD83C, 0xDFFB, 0x200D, 0x2696, 0xFE0F,
                        0xD83D, 0xDC68, 0xD83C, 0xDFFB, 0x200D, 0x2708, 0xFE0F};
  TextRun text_run(kStr, base::size(kStr));

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(base::size(kStr), word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiHeartZWJSequence) {
  // A ZWJ, followed by two family ZWJ Sequences.
  const UChar kStr[] = {0xD83D, 0xDC69, 0x200D, 0x2764, 0xFE0F, 0x200D,
                        0xD83D, 0xDC8B, 0x200D, 0xD83D, 0xDC68, 0x0};
  TextRun text_run(kStr, 11);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(11u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiSignsOfHornsModifier) {
  // A Sign of the Horns emoji, followed by a fitzpatrick modifer
  const UChar kStr[] = {0xD83E, 0xDD18, 0xD83C, 0xDFFB, 0x0};
  TextRun text_run(kStr, 4);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(4u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiExtraZWJPrefix) {
  // A ZWJ, followed by a family and a heart-kiss sequence.
  const UChar kStr[] = {0x200D, 0xD83D, 0xDC68, 0x200D, 0xD83D, 0xDC69,
                        0x200D, 0xD83D, 0xDC67, 0x200D, 0xD83D, 0xDC66,
                        0xD83D, 0xDC69, 0x200D, 0x2764, 0xFE0F, 0x200D,
                        0xD83D, 0xDC8B, 0x200D, 0xD83D, 0xDC68, 0x0};
  TextRun text_run(kStr, 23);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(22u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentEmojiSubdivisionFlags) {
  // Subdivision flags for Wales, Scotland, England.
  const UChar kStr[] = {0xD83C, 0xDFF4, 0xDB40, 0xDC67, 0xDB40, 0xDC62, 0xDB40,
                        0xDC77, 0xDB40, 0xDC6C, 0xDB40, 0xDC73, 0xDB40, 0xDC7F,
                        0xD83C, 0xDFF4, 0xDB40, 0xDC67, 0xDB40, 0xDC62, 0xDB40,
                        0xDC73, 0xDB40, 0xDC63, 0xDB40, 0xDC74, 0xDB40, 0xDC7F,
                        0xD83C, 0xDFF4, 0xDB40, 0xDC67, 0xDB40, 0xDC62, 0xDB40,
                        0xDC65, 0xDB40, 0xDC6E, 0xDB40, 0xDC67, 0xDB40, 0xDC7F};
  TextRun text_run(kStr, base::size(kStr));

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(42u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKCommon) {
  const UChar kStr[] = {0xFF08,  // FULLWIDTH LEFT PARENTHESIS (script=common)
                        0xFF08,  // FULLWIDTH LEFT PARENTHESIS (script=common)
                        0xFF08,  // FULLWIDTH LEFT PARENTHESIS (script=common)
                        0x0};
  TextRun text_run(kStr, 3);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(3u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKCommonAndNonCJK) {
  const UChar kStr[] = {0xFF08,  // FULLWIDTH LEFT PARENTHESIS (script=common)
                        'a', 'b', 0x0};
  TextRun text_run(kStr, 3);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(1u, word_result->NumCharacters());

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentCJKSmallFormVariants) {
  const UChar kStr[] = {0x5916,  // CJK UNIFIED IDEOGRPAH
                        0xFE50,  // SMALL COMMA
                        0x0};
  TextRun text_run(kStr, 2);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, SegmentHangulToneMark) {
  const UChar kStr[] = {0xC740,  // HANGUL SYLLABLE EUN
                        0x302E,  // HANGUL SINGLE DOT TONE MARK
                        0x0};
  TextRun text_run(kStr, 2);

  scoped_refptr<const ShapeResult> word_result;
  CachingWordShapeIterator iterator(cache.get(), text_run, &font);

  ASSERT_TRUE(iterator.Next(&word_result));
  EXPECT_EQ(2u, word_result->NumCharacters());

  ASSERT_FALSE(iterator.Next(&word_result));
}

TEST_F(CachingWordShaperTest, TextOrientationFallbackShouldNotInFallbackList) {
  const UChar kStr[] = {
      'A',  // code point for verticalRightOrientationFontData()
      // Ideally we'd like to test uprightOrientationFontData() too
      // using code point such as U+3042, but it'd fallback to system
      // fonts as the glyph is missing.
      0x0};
  TextRun text_run(kStr, 1);

  font_description.SetOrientation(FontOrientation::kVerticalMixed);
  Font vertical_mixed_font = Font(font_description);
  ASSERT_TRUE(vertical_mixed_font.CanShapeWordByWord());

  CachingWordShaper shaper(vertical_mixed_font);
  FloatRect glyph_bounds;
  HashSet<const SimpleFontData*> fallback_fonts;
  ASSERT_GT(shaper.Width(text_run, &fallback_fonts, &glyph_bounds), 0);
  EXPECT_EQ(0u, fallback_fonts.size());
}

TEST_F(CachingWordShaperTest, GlyphBoundsWithSpaces) {
  CachingWordShaper shaper(font);

  TextRun periods(reinterpret_cast<const LChar*>(".........."), 10);
  FloatRect periods_glyph_bounds;
  float periods_width = shaper.Width(periods, nullptr, &periods_glyph_bounds);

  TextRun periods_and_spaces(
      reinterpret_cast<const LChar*>(". . . . . . . . . ."), 19);
  FloatRect periods_and_spaces_glyph_bounds;
  float periods_and_spaces_width = shaper.Width(
      periods_and_spaces, nullptr, &periods_and_spaces_glyph_bounds);

  // The total width of periods and spaces should be longer than the width of
  // periods alone.
  ASSERT_GT(periods_and_spaces_width, periods_width);

  // The glyph bounds of periods and spaces should be longer than the glyph
  // bounds of periods alone.
  ASSERT_GT(periods_and_spaces_glyph_bounds.Width(),
            periods_glyph_bounds.Width());
}

}  // namespace blink


text:
<form class="form" id="formRegister" name="formRegister" novalidate>

        <input type="password"
               class="form-control"
               id="password"
               name="password"
               placeholder="{{'security.form.password.placeholder'|translate}}"
               ng-model="registerVm.formData.password"
               autofocus
               required>

        <input type="password"
               class="form-control"
               id="passwordConfirm"
               name="passwordConfirm"
               placeholder="{{'security.form.password-confirm.placeholder'|translate}}"
               ng-model="registerVm.formData.passwordConfirm"
               match="registerVm.formData.password"
               required>

            <button ng-click="registerVm.register()"
                    ng-disabled="formRegister.$invalid"
                    translate="security.form.btn.register.label"
                    class="btn btn-block btn-primary">
            </button>

</form>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Encryptor xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" />

View Javadoc

1
18  package org.apache.hadoop.hbase.io.crypto;
19
20  import java.io.OutputStream;
21  import java.security.Key;
22
23  import org.apache.hadoop.hbase.classification.InterfaceAudience;
24  import org.apache.hadoop.hbase.classification.InterfaceStability;
25
26  /**
27   * Encryptors apply a cipher to an OutputStream to produce ciphertext.
28   */
29  @InterfaceAudience.Public
30  @InterfaceStability.Evolving
31  public interface Encryptor {
32
33    /**
34     * Set the secret key
35     * @param key
36     */
37    public void setKey(Key key);
38
39    /**
40     * Get the expected length for the initialization vector
41     * @return the expected length for the initialization vector
42     */
43    public int getIvLength();
44
45    /**
46     * Get the cipher's internal block size
47     * @return the cipher's internal block size
48     */
49    public int getBlockSize();
50
51    /**
52     * Get the initialization vector
53     */
54    public byte[] getIv();
55
56    /**
57     * Set the initialization vector
58     * @param iv
59     */
60    public void setIv(byte[] iv);
61
62    /**
63     * Create a stream for encryption
64     * @param out
65     */
66    public OutputStream createEncryptionStream(OutputStream out);
67
68    /**
69     * Reset state, reinitialize with the key and iv
70     */
71    void reset();
72  }

This page was automatically generated by Maven


text:
function [gal] = cm32gal(cm3)
% Convert volume from cubic centimeters to US liquid gallons.
% Chad Greene 2012
gal = cm3*0.00026417205236;


text:
var TweetView = Backbone.View.extend({
  className: "tweet",
  template: JST["templates/tweet"],

  render: function() {
    this.$el.html(this.template(this.model.attributes));
  }
});


text:
#include "AzulCore.h"

#include "EnumName.h"
#include "TextMan.h"
#include "Text.h"
#include "Rect.h"
#include "Image.h"
#include "ImageMan.h"
#include "BoxModel.h"
#include "BoxSprite.h"

//externs must be exterminated

extern GLShaderManager	shaderManager;

BoxSprite :: BoxSprite(  SpriteBatchName::Name spriteBatchName, SpriteName::Name _spriteName, float _lineWidth, const Vect &_color, GameSprite *gSprite)
{
	this->privBoxSprite( spriteBatchName,  _spriteName, _lineWidth, _color, Rect(gSprite->posX, gSprite->posY, gSprite->origWidth, gSprite->origHeight) );
}

BoxSprite :: BoxSprite(  SpriteBatchName::Name spriteBatchName, SpriteName::Name _spriteName, float _lineWidth, const Vect &_color, Rect destRect)
{
	this->privBoxSprite( spriteBatchName,  _spriteName, _lineWidth, _color, destRect );
}

void BoxSprite :: privBoxSprite(  SpriteBatchName::Name spriteBatchName, SpriteName::Name _spriteName, float _lineWidth, const Vect &_color, Rect destRect)
{
	this->setName( 0 );

	this->lineWidth = _lineWidth;
	this->color = _color;

	this->spriteName = _spriteName;

	BoxModel *p = new BoxModel( destRect );
	this->boxModel = p;

	this->angle = 0.0f;

	this->origWidth = p->destRect.width;
	this->origHeight = p->destRect.height;

	this->posX = p->destRect.x;
	this->posY = p->destRect.y;

	this->scaleX = 1.0f;
	this->scaleY = 1.0f;

	this->LocalToWorld.set(IDENTITY);
	this->ModelView.set(IDENTITY);
	this->spriteBatchName = spriteBatchName;
	SBNode *batch = SpriteBatchManager::Find(spriteBatchName);
	batch->addSprite( _spriteName, this);
}

// Constructor make sure everything is initialized
BoxSprite :: BoxSprite( const char * const _Name, BoxModel * const p)
{
	this->boxModel = p;
	this->setName( _Name );

	this->angle = 0.0f;

	this->origWidth = p->destRect.width;
	this->origHeight = p->destRect.height;

	this->posX = p->destRect.x;
	this->posY = p->destRect.y;

	this->scaleX = 1.0f;
	this->scaleY = 1.0f;

	this->LocalToWorld.set(IDENTITY);
	this->ModelView.set(IDENTITY);
};

void BoxSprite::transform( void )
{

	// create the tranformation matrices
	Matrix Scale(SCALE, this->scaleX, this->scaleY, 1.0f);
	Matrix RotZ( ROT_Z, angle );
	Matrix Trans( TRANS, this->posX, this->posY, 0.0f);

	// create the origin in the lower left corner
	Matrix TransToOriginLowerLeft( TRANS, -400, -300.f, 0.0f);

	// Create the local to world matrix (ie Model)
	this->LocalToWorld =  Scale * RotZ * Trans * TransToOriginLowerLeft;

	// Create the ModelView ( LocalToWorld * View)
	// Some pipelines have the project concatenated, others don't
	// Best to keep the separated, you can always join them with a quick multiply
   this->ModelView = this->LocalToWorld * Camera::getViewMatrix();

};

void BoxSprite::setRenderState( void )
{
	// Blends for sprites
	glEnable(GL_BLEND);
	glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);

	// Use the stock shader
	Matrix mvp = ModelView * Camera::getProjMatrix();

	// flat shader
	shaderManager.UseStockShader(GLT_SHADER_FLAT,
						& mvp,
						& this->color);

};

void BoxSprite::draw( void )
{
	if( display )
	{
		glBindVertexArray(this->boxModel->vao);

		/*  render primitives from array data */
		glLineWidth(this->lineWidth);
		glDrawArrays(GL_LINE_LOOP, 0, 4);
	}
};

void BoxSprite::privDraw()
{
	transform();
	setRenderState();
	draw();
}


text: Presentation for [web-5 conf](http://conf2012.web-5.org/en/) the 14th June 2013.


text:
package com.creditease.agent.feature.notifycenter.handlers;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.creditease.agent.ConfigurationManager;
import com.creditease.agent.feature.notifycenter.NCConstant;
import com.creditease.agent.feature.notifycenter.NCConstant.StateFlag;
import com.creditease.agent.feature.notifycenter.NCEventStatusManager;
import com.creditease.agent.feature.notifycenter.task.NotificationTask;
import com.creditease.agent.feature.notifycenter.task.PersistentTask;
import com.creditease.agent.helpers.DataConvertHelper;
import com.creditease.agent.helpers.DataStoreHelper;
import com.creditease.agent.helpers.JSONHelper;
import com.creditease.agent.helpers.StringHelper;
import com.creditease.agent.monitor.api.NotificationEvent;
import com.creditease.agent.spi.AbstractBaseAction;
import com.creditease.agent.spi.AbstractHandler;
import com.creditease.agent.spi.ActionContext;
import com.creditease.agent.spi.I1NQueueWorker;
import com.creditease.agent.spi.IActionEngine;

/**
 *
 * @author peihua
 *
 * @actionChange add priorityList
 *
 *               args:
 *
 *               {
 *
 *               "action_mail": "[\"priority1@mail.com,priority1@mail.com\", \"priority2@mail.com\"]",
 *
 *               "action_sms": "[\"1353334111,135333411,135333433\", \"135333422,135333432\"]",
 *
 *               "action_phone":"[\"135333433,135333433\", \"135333433,135333433\"]",
 *
 *               }
 *
 */

public class NCJudgementHandler extends AbstractHandler<NotificationEvent> {

    private class NotificationConvergenceAction extends AbstractBaseAction {

        /**
         * @param cName
         * @param feature
         * @param engine
         */
        public NotificationConvergenceAction(String cName, String feature, IActionEngine engine) {

            super(cName, feature, engine);
        }

        @SuppressWarnings("unchecked")
        @Override
        public void doAction(ActionContext context) throws Exception {

            String eventKey = (String) context.getParam("eventKey");
            NotificationEvent event = (NotificationEvent) context.getParam("event");
            String stateDataStr = (String) context.getParam("stateDataStr");

            Map<String, Object> stateData = null;

            /**
             * if none, take this event as the first event record
             */
            if (null == stateDataStr) {

                if (log.isDebugEnable()) {
                    log.debug(this, "NC Convergence Event happens FIRST TIME: NTFKEY=" + eventKey + ",time=" + event.getTime());
                }

                Map<String, Object> statusSet = playAsFirstEventRecordConvergence(event, eventKey);
                doNotificationConvergence(event, eventKey, statusSet);
                return;
            }

            stateData = JSONHelper.toObject(stateDataStr, Map.class);

            if (log.isDebugEnable()) {
                log.debug(this, "NC Event happens with stateData: "+stateDataStr);
            }

            long curTime = System.currentTimeMillis();
            long processTime = DataConvertHelper.toLong(stateData.get(NCConstant.COLUMN_PROCESSTIME), -1);

            if (processTime > -1) {

                if (log.isDebugEnable()) {
                    log.debug(this, "NC Convergence Event Check Result, Over Precesed TTL: processTTL=" + processTTL
                            + ",curTime - processTime=" + (curTime - processTime));
                }

                /**
                 * if there is processTime and processTime exceeds processTTL, take this event as a newone
                 */
                if (curTime - processTime > processTTL) {
                    stateData = playAsFirstEventRecordConvergence(event, eventKey);
                }
                else {
                    int count = increEventCount(stateData);
                    stateData.put(NCConstant.EVENT_COUNT, count);
                    playAsReEntryRecordConvergence(event, eventKey, stateData, false);
                    if (log.isTraceEnable()) {
                        log.info(this, "NCJudgementHandler END: key=" + eventKey);
                    }
                    return;
                }

            }
            else {
                int count = increEventCount(stateData);
                stateData.put(NCConstant.EVENT_COUNT, count);
            }

            doNotificationConvergence(event, eventKey, stateData);

        }

        /**
         * the logic of gradient convergence
         * @param event
         * @param eventKey
         * @param stateData
         */
        private void doNotificationConvergence(NotificationEvent event, String eventKey, Map<String, Object> stateData) {

            String convergence = event.getArg("convergences");
            List<String> convs = Arrays.asList(convergence.split(","));
            String count = stateData.get(NCConstant.EVENT_COUNT) +"";
            // 预警梯度收敛设为-1则每次报警触发actions
            if (convs.contains(count) || (convs.size() == 1 && convs.get(0).equals("-1"))) {
                if (log.isDebugEnable()) {
                    log.debug(this, "NC Convergence Event Check Result, RE-Action Notify: current event=" + count);
                }
                playAsReEntryRecordConvergence(event, eventKey, stateData, true);
                addNotficationTask(event, stateData);
            }
            else {
                playAsReEntryRecordConvergence(event, eventKey, stateData, false);
            }

            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler END: key=" + eventKey);
            }
        }

        @Override
        public String getSuccessNextActionId() {

            return null;
        }

        @Override
        public String getFailureNextActionId() {

            return null;
        }

        @Override
        public String getExceptionNextActionId() {

            return null;
        }

        private Map<String, Object> playAsFirstEventRecordConvergence(NotificationEvent event, String eventKey) {

            Map<String, Object> statusSet = new LinkedHashMap<String, Object>();

            statusSet.put(NCConstant.COLUMN_STARTTIME, event.getTime());
            statusSet.put(NCConstant.COLUMN_STATE, NCConstant.StateFlag.NEWCOME.getStatFlag());
            statusSet.put(NCConstant.COLUMN_RETRY_COUNT, 0);
            statusSet.put(NCConstant.COLUMN_LATESTIME, System.currentTimeMillis());

            // First Time NTFE take priority as the "0" Priority.
            statusSet.put(NCConstant.COLUMN_PRIORITY, 0);
            statusSet.put(NCConstant.EVENT_COUNT, 1);

            String statusStr = JSONHelper.toString(statusSet);

            event.addArg(NCConstant.NCFirstEvent, "true");
            event.addArg(NCConstant.NTFKEY, eventKey);
            event.addArg(NCConstant.NTFVALUE, statusStr);

            return statusSet;
        }

        private void playAsReEntryRecordConvergence(NotificationEvent event, String eventKey, Map<String, Object> stateData,
                boolean isRetry) {

            int curState = (int) stateData.get(NCConstant.COLUMN_STATE);

            if (curState < StateFlag.UPDATE.getStatFlag() && !"true".equals(event.getArg(NCConstant.NCFirstEvent))) {
                curState = StateFlag.UPDATE.getStatFlag();
                stateData.put(NCConstant.COLUMN_STATE, curState);
            }

            // NOTE: if the state is VIEW, for this part that means VIEW & UPDATE
            if (curState == StateFlag.VIEW.getStatFlag()) {
                curState = StateFlag.VIEWUPDATE.getStatFlag();
                stateData.put(NCConstant.COLUMN_STATE, curState);
            }

            if (isRetry == true) {
                int curRetry = (Integer) stateData.get(NCConstant.COLUMN_RETRY_COUNT) + 1;
                stateData.put(NCConstant.COLUMN_RETRY_COUNT, curRetry);
                stateData.put(NCConstant.COLUMN_LATESTIME, System.currentTimeMillis());
            }

            stateData.put(NCConstant.COLUMN_LATESTRECORDTIME, event.getTime());

            String statusStr = JSONHelper.toString(stateData);

            if (null == event.getArg(NCConstant.NCFirstEvent)) {
                event.addArg(NCConstant.NCFirstEvent, "false");
            }
            event.addArg(NCConstant.NTFKEY, eventKey);
            event.addArg(NCConstant.NTFVALUE, statusStr);

            // 持久化操作
            addPersistentTask(event);
        }

    }

    private int retryTime = 3;
    /**
     * NOTE: processTTL is the time to give human to fix the issue, see we are nice as default is 4 hours
     */
    private int processTTL = 4 * 3600 * 1000;
    private long frozenTime = 300000;
    private I1NQueueWorker qworker;
    private IActionEngine engine;
    private NCEventStatusManager eventStatusManager;

    public NCJudgementHandler(String cName, String feature) {

        super(cName, feature);

        eventStatusManager = (NCEventStatusManager) ConfigurationManager.getInstance().getComponent(feature, "EventStatusManager");

        retryTime = DataConvertHelper
                .toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "nc.notify.retry"), 3);
        processTTL = DataConvertHelper
                .toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "nc.notify.ttl"), 4) * 3600 * 1000;
        frozenTime = DataConvertHelper.toLong(
                this.getConfigManager().getFeatureConfiguration(this.feature, "nc.notify.frozenTime"), 300) * 1000;

        qworker = (I1NQueueWorker) ConfigurationManager.getInstance().getComponent(this.feature,
                NCConstant.NC1NQueueWorkerName);
        engine = this.getActionEngineMgr().getActionEngine("NCJudgementEngine");
        new NotificationConvergenceAction(NotificationConvergenceAction.class.getSimpleName(), feature, engine);
    }

    /**
     * 预警通知决策流程
     */
    @SuppressWarnings({ "unchecked" })
    @Override
    public void handle(NotificationEvent event) {

        /**
         * Step 1 generate eventKey
         **/
        String eventKey = getKeyfromNTFE(event);

        if (log.isTraceEnable()) {
            log.info(this, "NCJudgementHandler START: key=" + eventKey + ",event=" + event.toJSONString());
        }

        /***
         * Step 1.1 check if there is SYNC atomic key on enevtKey
         *
         */
        boolean isSYNCAtomicKey = eventStatusManager.checkSyncAtomicKey(eventKey);
        if (isSYNCAtomicKey) {
            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler event is locked:" + event.toJSONString());
            }
            return;
        }

        /**
         * Step 2 Check if there is a cache for current event
         **/
        String stateDataStr = eventStatusManager.getEventCache(eventKey);

        if(!StringHelper.isEmpty(event.getArg("convergences"))) {

            ActionContext ac = new ActionContext();
            ac.putParam("eventKey", eventKey);
            ac.putParam("event", event);
            ac.putParam("stateDataStr", stateDataStr);
            engine.execute(NotificationConvergenceAction.class.getSimpleName(), ac);
            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler END: key=" + eventKey);
            }
            return;
        }

        /**
         * Step 2.1 if none, take this event as the first event record
         */
        if (null == stateDataStr) {

            if (log.isDebugEnable()) {
                log.debug(this, "NC Event happens FIRST TIME: NTFKEY=" + eventKey + ",time=" + event.getTime());
            }

            playAsFirstEventRecord(event, eventKey);

            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler END: key=" + eventKey);
            }

            return;
        }

        /**
         * Step 2.2 if there is a cache for current event, we need get the cache state data
         */
        Map<String, Object> stateData = JSONHelper.toObject(stateDataStr, Map.class);

        if (log.isDebugEnable()) {
            log.debug(this, "NC Event happens OVERTIMEs: NTFKEY=" + eventKey + ",time=" + event.getTime());
        }

        /**
         * Step 3 if there is processTime and processTime exceeds processTTL, that means human has seen this event, and
         * processTTL is the timespan we give to them to fix the issue, if reach processTTL, that may mean the issue is
         * not fixed or may be a new issue, anyway, we will take current event as NEWCOME. then a new first event record
         * is generated, it is the split line to the previous first event record
         */
        long curTime = System.currentTimeMillis();
        long processTime = DataConvertHelper.toLong(stateData.get(NCConstant.COLUMN_PROCESSTIME), -1);

        if (processTime > -1) {

            if (log.isDebugEnable()) {
                log.debug(this, "NC Event Check Result, Over process TTL: processTTL=" + processTTL
                        + ",curTime - processTime=" + (curTime - processTime));
            }

            /**
             * if over processTTL, take this as a new event record
             */
            if (curTime - processTime > processTTL) {
                playAsFirstEventRecord(event, eventKey);
            }
            /**
             * if less than processTTL, take this as a re-entry event record then we will not send the notification
             */
            else {
                playAsReEntryRecord(event, eventKey, stateData, false);
            }

            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler END: key=" + eventKey);
            }
            return;
        }

        /**
         * Step 4 check if reach notification frozenTime, if not, just update the COLUMN_LATESTRECORDTIME
         */
        long timeSpan = curTime - DataConvertHelper.toLong(stateData.get(NCConstant.COLUMN_LATESTIME), 0);

        if (timeSpan < frozenTime) {
            if (log.isDebugEnable()) {
                log.debug(this, "NC Event Check Result, NO Rearch Frozen Time: timespan=" + timeSpan + ",frozentime="
                        + frozenTime);
            }

            playAsReEntryRecord(event, eventKey, stateData, false);

            if (log.isTraceEnable()) {
                log.info(this, "NCJudgementHandler END: key=" + eventKey);
            }
            return;
        }

        /**
         * Step 5 if reach frozeTime, then check if reach MAX retry times
         */
        int curRetry = (int) stateData.get(NCConstant.COLUMN_RETRY_COUNT);
        /**
         * Step 5.1 if less than retryTime, we need send notification and update the retry & latest_time
         */
        if (curRetry < retryTime) {

            if (log.isDebugEnable()) {
                log.debug(this, "NC Event Check Result, RE-Action Notify: retry done=" + (++curRetry));
            }

            playAsReEntryRecord(event, eventKey, stateData, true);

            // doing notification actions
            addNotficationTask(event, stateData);
        }
        /**
         * Step 5.2 if more than retryTime, just update status, not send notification
         */
        else {

            /**
             * Step 5.3 check priority from cache
             *
             */
            log.debug(this, "Reach MAX Retry with NO RE-Action Notify: retry:" + curRetry);

            int priority = (int) stateData.get(NCConstant.COLUMN_PRIORITY);

            if (priority < getMaxPrioritySizeByEvent(event) - 1) {

                log.debug(this, "current priority is: " + priority);

                /**
                 *
                 * Add priorityFlag to make playAsReEntryRecord could distinct this step,
                 *
                 * if priorityFlag is true, it need ++ priority
                 *
                 */
                stateData.put(NCConstant.PRIORITYFLAG, true);

                playAsReEntryRecord(event, eventKey, stateData, false);

                // doing notification actions
                addNotficationTask(event, stateData);

            }
            else {

                log.debug(this, "Reach MAX Priority size , priority: " + priority);
                playAsReEntryRecord(event, eventKey, stateData, false);
            }
        }

        if (log.isTraceEnable()) {
            log.info(this, "NCJudgementHandler END: key=" + eventKey);
        }
    }

    /**
     * playAsReEntryRecord
     *
     * @param event
     * @param eventKey
     * @param stateData
     * @param isRetry
     */
    private void playAsReEntryRecord(NotificationEvent event, String eventKey, Map<String, Object> stateData,
            boolean isRetry) {

        int curstate = (int) stateData.get(NCConstant.COLUMN_STATE);

        if (curstate < StateFlag.UPDATE.getStatFlag()) {
            curstate = StateFlag.UPDATE.getStatFlag();
            stateData.put(NCConstant.COLUMN_STATE, curstate);
        }

        // NOTE: if the state is VIEW, for this part that means VIEW & UPDATE
        if (curstate == StateFlag.VIEW.getStatFlag()) {
            curstate = StateFlag.VIEWUPDATE.getStatFlag();
            stateData.put(NCConstant.COLUMN_STATE, curstate);
        }

        if (isRetry == true) {
            int curRetry = (Integer) stateData.get(NCConstant.COLUMN_RETRY_COUNT) + 1;
            stateData.put(NCConstant.COLUMN_RETRY_COUNT, curRetry);
            stateData.put(NCConstant.COLUMN_LATESTIME, System.currentTimeMillis());
        }

        stateData.put(NCConstant.COLUMN_LATESTRECORDTIME, event.getTime());

        int count = increEventCount(stateData);
        stateData.put(NCConstant.EVENT_COUNT, count);

        /**
         * check and increase priority if needed
         */
        ackIncPriority(stateData);

        String statusStr = JSONHelper.toString(stateData);

        event.addArg(NCConstant.NCFirstEvent, "false");
        event.addArg(NCConstant.NTFKEY, eventKey);
        event.addArg(NCConstant.NTFVALUE, statusStr);

        addPersistentTask(event);
    }

    /**
     * playAsFirstEventRecord
     *
     * @param event
     * @param eventKey
     */
    private void playAsFirstEventRecord(NotificationEvent event, String eventKey) {

        Map<String, Object> statusSet = new LinkedHashMap<String, Object>();

        statusSet.put(NCConstant.COLUMN_STARTTIME, event.getTime());
        statusSet.put(NCConstant.COLUMN_STATE, NCConstant.StateFlag.NEWCOME.getStatFlag());
        statusSet.put(NCConstant.COLUMN_RETRY_COUNT, 1);
        statusSet.put(NCConstant.COLUMN_LATESTIME, System.currentTimeMillis());
        // NOTE: the latest record event time, then we can find out all records from first record startTime to this time
        statusSet.put(NCConstant.COLUMN_LATESTRECORDTIME, event.getTime());

        // First Time NTFE take priority as the "0" Priority.
        statusSet.put(NCConstant.COLUMN_PRIORITY, 0);
        statusSet.put(NCConstant.EVENT_COUNT, 1);

        String statusStr = JSONHelper.toString(statusSet);

        event.addArg(NCConstant.NCFirstEvent, "true");
        event.addArg(NCConstant.NTFKEY, eventKey);
        event.addArg(NCConstant.NTFVALUE, statusStr);

        addPersistentTask(event);

        addNotficationTask(event, statusSet);
    }

    /**
     * 预警特征提取
     **/
    public String getKeyfromNTFE(NotificationEvent data) {

        StringBuffer keybuffer = new StringBuffer();
        keybuffer.append(data.getIP() + NCConstant.seperator);
        keybuffer.append(data.getId() + NCConstant.seperator);
        keybuffer.append(data.getArg("component") + NCConstant.seperator);
        keybuffer.append(data.getArg("feature") + NCConstant.seperator);
        keybuffer.append(DataStoreHelper.decodeForMongoDB(data.getTitle()).hashCode());

        String key = keybuffer.toString();
        return key;
    }

    /**
     * 添加预警事件预警到短信邮件通知任务
     */
    public void addNotficationTask(NotificationEvent event, Map<String, Object> statusSet) {

        NotificationTask taskN = new NotificationTask(cName, feature);

        taskN.put(NCConstant.NCEventParam, event);

        // add priority for taskN
        taskN.put(NCConstant.PRIORITYLEVEL, this.getCurrentEventPriority(statusSet));

        qworker.put(taskN);
    }

    /**
     * 添加预警事件到持久化任务
     */
    public void addPersistentTask(NotificationEvent event) {

        PersistentTask taskP = new PersistentTask(cName, feature);

        taskP.put(NCConstant.NCEventParam, event);

        qworker.put(taskP);
    }

    @SuppressWarnings("rawtypes")
    public int getMaxPrioritySizeByEvent(NotificationEvent event) {

        int maxPriority = 0;

        Map<String, String> args = event.getArgs(true);

        for (String key : args.keySet()) {

            if (key.indexOf("action_") != 0) {
                continue;
            }

            String actionstr = args.get(key);

            List actionlist = JSONHelper.toObject(actionstr, LinkedList.class);

            int size = actionlist.size();

            if (size > maxPriority) {

                maxPriority = size;
            }
        }

        return maxPriority;
    }

    /***
     *
     * Increase Priority if need
     *
     */
    public void ackIncPriority(Map<String, Object> stateData) {

        Object pflag = stateData.get(NCConstant.PRIORITYFLAG);

        if (pflag != null && ((boolean) pflag == true)) {

            int prioriy = (int) stateData.get(NCConstant.COLUMN_PRIORITY) + 1;

            stateData.put(NCConstant.COLUMN_PRIORITY, prioriy);

            // retry need recover to zero
            stateData.put(NCConstant.COLUMN_RETRY_COUNT, 1);
            stateData.put(NCConstant.COLUMN_LATESTIME, System.currentTimeMillis());
            stateData.put(NCConstant.PRIORITYFLAG, false);
        }
    }

    public int getCurrentEventPriority(Map<String, Object> stateData) {

        if (stateData != null) {
            Integer p = (Integer) stateData.get(NCConstant.COLUMN_PRIORITY);
            return (p == null) ? 0 : p;
        }
        else {
            return 0;
        }

    }

    private int increEventCount(Map<String, Object> stateData) {
        Integer count = (Integer) stateData.get(NCConstant.EVENT_COUNT);
        if (null == count) {
            count = 0;
        }
        count = count + 1;
        return count;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
	<maintainer type="person">
		<email>radhermit@gentoo.org</email>
		<name>Tim Harder</name>
	</maintainer>
	<use>
    <flag name="sync">Enable "task sync" support</flag>
    <flat name="shell">Pull in app-misc/tasksh for interactive task processing</flag>
    <flag name="taskopen">Pull in app-misc/taskopen for attaching files to tasks</flag>
	</use>
</pkgmetadata>


text: Rails.application.config.session_store :cookie_store, key: '_reminder_session'


text:
<?php

class view extends view_base  {}


text:
package org.intellij.plugins.markdown;

public class MarkdownTestingUtil {
  public static final String TEST_DATA_PATH = findTestDataPath();

  private MarkdownTestingUtil() {
  }

  private static String findTestDataPath() {
	  return "";
  }
}


text:
#!/usr/bin/env node
'use strict';

/* global process */

var program = require('commander');
var packageJson = require('../package.json');
var _ = require('underscore');
var linker = require('../');

function processLibReferences(aString) {
    var libReferences = aString.split(',');
    var libReferenceMap = {};

    _.forEach(libReferences, function (aPotentialLibReference) {
        var reference = aPotentialLibReference.split('=');

        if (reference.length === 2) {
            // write the map in reverse style, because underscore foreach passes the value
            // as first argument, an the key as second
            libReferenceMap[reference[1]] = reference[0];
        }
    });

    return libReferenceMap;
}

program
    .version(packageJson.version)
    .usage('[options] <sources>')
    .description(packageJson.description)
    .name(packageJson.name);

program
    .option('-o, --overwrite', 'If turned on, the source files will get overwritten')
    .option('-d, --destination [dest]', 'The destination for the processed files')
    .option('-c, --clean-existing-references', 'Removed existing references')
    .option('-l, --lib-references [reference-list]', 'A list of reference files for your librarys', processLibReferences)
    .option('-w, --working-directory [new-working-directory]', 'The working directory to use as basepath')
    .parse(process.argv);

linker
    .overwriteSource(program.overwrite)
    .destDir(program.destination)
    .cleanExistingReferences(program.cleanExistingReferences)
    .workingDirectory(program.workingDirectory);

_.forEach(program.args, linker.addSource);
_.forEach(program.libReferences, linker.libReference);

linker.processSources();


text:
using blink::WebInputEvent;

namespace content {
namespace {

const int kTestRoutingId = 3;
const int kTestProcessId = 1;

}  // namespace

TEST(RenderWidgetHostLatencyTrackerTest, Basic) {
  RenderWidgetHostLatencyTracker tracker;
  tracker.Initialize(kTestRoutingId, kTestProcessId);

  {
    auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
        5.f, -5.f, 0, blink::WebGestureDeviceTouchscreen);
    scroll.timeStampSeconds =
        (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
    ui::LatencyInfo scroll_latency;
    tracker.OnInputEvent(scroll, &scroll_latency);
    EXPECT_TRUE(
        scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                   tracker.latency_component_id(), nullptr));
    EXPECT_TRUE(
        scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
                                   0, nullptr));
    EXPECT_EQ(1U, scroll_latency.input_coordinates_size);
  }

  {
    auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
        blink::WebMouseWheelEvent::PhaseChanged);
    wheel.timeStampSeconds =
        (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
    ui::LatencyInfo wheel_latency;
    tracker.OnInputEvent(wheel, &wheel_latency);
    EXPECT_TRUE(
        wheel_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                  tracker.latency_component_id(), nullptr));
    EXPECT_TRUE(
        wheel_latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
                                   0, nullptr));
    EXPECT_EQ(1U, wheel_latency.input_coordinates_size);
  }

  {
    SyntheticWebTouchEvent touch;
    touch.PressPoint(0, 0);
    touch.PressPoint(1, 1);
    ui::LatencyInfo touch_latency;
    tracker.OnInputEvent(touch, &touch_latency);
    EXPECT_TRUE(
        touch_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                  tracker.latency_component_id(), nullptr));
    EXPECT_TRUE(
        touch_latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
                                   0, nullptr));
    EXPECT_EQ(2U, touch_latency.input_coordinates_size);
  }
}

TEST(RenderWidgetHostLatencyTrackerTest,
     LatencyTerminatedOnAckIfRenderingNotScheduled) {
  RenderWidgetHostLatencyTracker tracker;
  tracker.Initialize(kTestRoutingId, kTestProcessId);

  {
    auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin(5.f, -5.f);
    ui::LatencyInfo scroll_latency;
    tracker.OnInputEvent(scroll, &scroll_latency);
    tracker.OnInputEventAck(scroll, &scroll_latency);
    EXPECT_TRUE(scroll_latency.FindLatency(
        ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, nullptr));
    EXPECT_TRUE(scroll_latency.terminated);
  }

  {
    auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
        blink::WebMouseWheelEvent::PhaseChanged);
    ui::LatencyInfo wheel_latency;
    tracker.OnInputEvent(wheel, &wheel_latency);
    tracker.OnInputEventAck(wheel, &wheel_latency);
    EXPECT_TRUE(wheel_latency.FindLatency(
        ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, nullptr));
    EXPECT_TRUE(wheel_latency.terminated);
  }

  {
    SyntheticWebTouchEvent touch;
    touch.PressPoint(0, 0);
    ui::LatencyInfo touch_latency;
    tracker.OnInputEvent(touch, &touch_latency);
    tracker.OnInputEventAck(touch, &touch_latency);
    EXPECT_TRUE(touch_latency.FindLatency(
        ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, nullptr));
    EXPECT_TRUE(touch_latency.terminated);
  }
}

TEST(RenderWidgetHostLatencyTrackerTest, InputCoordinatesPopulated) {
  RenderWidgetHostLatencyTracker tracker;
  tracker.Initialize(kTestRoutingId, kTestProcessId);

  {
    auto event = SyntheticWebMouseWheelEventBuilder::Build(-5, 0, 0, true);
    event.x = 100;
    event.y = 200;
    ui::LatencyInfo latency_info;
    tracker.OnInputEvent(event, &latency_info);
    EXPECT_EQ(1u, latency_info.input_coordinates_size);
    EXPECT_EQ(100, latency_info.input_coordinates[0].x);
    EXPECT_EQ(200, latency_info.input_coordinates[0].y);
  }

  {
    auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove);
    event.x = 300;
    event.y = 400;
    ui::LatencyInfo latency_info;
    tracker.OnInputEvent(event, &latency_info);
    EXPECT_EQ(1u, latency_info.input_coordinates_size);
    EXPECT_EQ(300, latency_info.input_coordinates[0].x);
    EXPECT_EQ(400, latency_info.input_coordinates[0].y);
  }

  {
    auto event = SyntheticWebGestureEventBuilder::Build(
        WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen);
    event.x = 500;
    event.y = 600;
    ui::LatencyInfo latency_info;
    tracker.OnInputEvent(event, &latency_info);
    EXPECT_EQ(1u, latency_info.input_coordinates_size);
    EXPECT_EQ(500, latency_info.input_coordinates[0].x);
    EXPECT_EQ(600, latency_info.input_coordinates[0].y);
  }

  {
    SyntheticWebTouchEvent event;
    event.PressPoint(700, 800);
    event.PressPoint(900, 1000);
    event.PressPoint(1100, 1200);  // LatencyInfo only holds two coordinates.
    ui::LatencyInfo latency_info;
    tracker.OnInputEvent(event, &latency_info);
    EXPECT_EQ(2u, latency_info.input_coordinates_size);
    EXPECT_EQ(700, latency_info.input_coordinates[0].x);
    EXPECT_EQ(800, latency_info.input_coordinates[0].y);
    EXPECT_EQ(900, latency_info.input_coordinates[1].x);
    EXPECT_EQ(1000, latency_info.input_coordinates[1].y);
  }

  {
    NativeWebKeyboardEvent event;
    event.type = blink::WebKeyboardEvent::KeyDown;
    ui::LatencyInfo latency_info;
    tracker.OnInputEvent(event, &latency_info);
    EXPECT_EQ(0u, latency_info.input_coordinates_size);
  }
}

TEST(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
  RenderWidgetHostLatencyTracker tracker;
  tracker.Initialize(kTestRoutingId, kTestProcessId);

  auto scroll_begin = SyntheticWebGestureEventBuilder::BuildScrollBegin(5, -5);
  ui::LatencyInfo scroll_latency;
  scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0,
                                  0);
  tracker.OnInputEvent(scroll_begin, &scroll_latency);
  EXPECT_TRUE(
      scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                 tracker.latency_component_id(), nullptr));
  EXPECT_EQ(2U, scroll_latency.latency_components.size());

  // The first GestureScrollUpdate should be provided with
  // INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT.
  auto first_scroll_update = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
      5.f, -5.f, 0, blink::WebGestureDeviceTouchscreen);
  scroll_latency = ui::LatencyInfo();
  scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0,
                                  0);
  tracker.OnInputEvent(first_scroll_update, &scroll_latency);
  EXPECT_TRUE(
      scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                 tracker.latency_component_id(), nullptr));
  EXPECT_TRUE(scroll_latency.FindLatency(
      ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
      tracker.latency_component_id(), nullptr));
  EXPECT_FALSE(scroll_latency.FindLatency(
      ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
      tracker.latency_component_id(), nullptr));
  EXPECT_EQ(3U, scroll_latency.latency_components.size());

  // Subseqeunt GestureScrollUpdates should be provided with
  // INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT.
  auto scroll_update = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
      -5.f, 5.f, 0, blink::WebGestureDeviceTouchscreen);
  scroll_latency = ui::LatencyInfo();
  scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0,
                                  0);
  tracker.OnInputEvent(scroll_update, &scroll_latency);
  EXPECT_TRUE(
      scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
                                 tracker.latency_component_id(), nullptr));
  EXPECT_FALSE(scroll_latency.FindLatency(
      ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
      tracker.latency_component_id(), nullptr));
  EXPECT_TRUE(scroll_latency.FindLatency(
      ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
      tracker.latency_component_id(), nullptr));
  EXPECT_EQ(3U, scroll_latency.latency_components.size());
}

}  // namespace content


text:
package seev

import (
	"encoding/xml"

	"github.com/fgrid/iso20022"
)

type Document03500102 struct {
	XMLName xml.Name                                     `xml:"urn:iso:std:iso:20022:tech:xsd:seev.035.001.02 Document"`
	Message *CorporateActionMovementPreliminaryAdviceV02 `xml:"CorpActnMvmntPrlimryAdvc"`
}

func (d *Document03500102) AddMessage() *CorporateActionMovementPreliminaryAdviceV02 {
	d.Message = new(CorporateActionMovementPreliminaryAdviceV02)
	return d.Message
}

// Scope
// An account servicer sends the CorporateActionMovementPreliminaryAdvice message to an account owner or its designated agent to pre-advise upcoming posting or reversal of securities and/or cash postings.
// Usage
// The message may also be used to:
// - re-send a message previously sent (the sub-function of the message is Duplicate),
// - provide a third party with a copy of a message for information (the sub-function of the message is Copy),
// - re-send to a third party a copy of a message for information (the sub-function of the message is Copy Duplicate),
// using the relevant elements in the business application header (BAH).
// ISO 15022 - 20022 COEXISTENCE
// This ISO 20022 message is reversed engineered from ISO 15022. Both standards will coexist for a certain number of years. Until this coexistence period ends, the usage of certain data types is restricted to ensure interoperability between ISO 15022 and 20022 users. Compliance to these rules is mandatory in a coexistence environment.  The coexistence restrictions are described in a Textual Rule linked to the Message Items they concern. These coexistence textual rules are clearly identified as follows:  "CoexistenceXxxxRule".
type CorporateActionMovementPreliminaryAdviceV02 struct {

	// General information about the movement preliminary advice document.
	MovementPreliminaryAdviceGeneralInformation *iso20022.CorporateActionPreliminaryAdviceType1 `xml:"MvmntPrlimryAdvcGnlInf"`

	// Identification of a previously sent movement preliminary advice document.
	PreviousMovementPreliminaryAdviceIdentification *iso20022.DocumentIdentification15 `xml:"PrvsMvmntPrlimryAdvcId,omitempty"`

	// Identification of a previously sent notification document.
	NotificationIdentification *iso20022.DocumentIdentification15 `xml:"NtfctnId,omitempty"`

	// Identification of a previously sent movement confirmation document.
	MovementConfirmationIdentification *iso20022.DocumentIdentification15 `xml:"MvmntConfId,omitempty"`

	// Identification of a related instruction document.
	InstructionIdentification *iso20022.DocumentIdentification9 `xml:"InstrId,omitempty"`

	// Identification of other documents as well as the document number.
	OtherDocumentIdentification []*iso20022.DocumentIdentification13 `xml:"OthrDocId,omitempty"`

	// Identification of an other corporate action event that needs to be closely linked to the processing of the event notified in this document.
	EventsLinkage []*iso20022.CorporateActionEventReference1 `xml:"EvtsLkg,omitempty"`

	// Reason for the reversal.
	ReversalReason *iso20022.CorporateActionReversalReason1 `xml:"RvslRsn,omitempty"`

	// General information about the corporate action event.
	CorporateActionGeneralInformation *iso20022.CorporateActionGeneralInformation23 `xml:"CorpActnGnlInf"`

	// General information about the safekeeping account, owner and account balance.
	AccountDetails *iso20022.AccountIdentification12Choice `xml:"AcctDtls"`

	// Information about the corporate action option.
	CorporateActionMovementDetails []*iso20022.CorporateActionOption20 `xml:"CorpActnMvmntDtls,omitempty"`

	// Provides additional information.
	AdditionalInformation *iso20022.CorporateActionNarrative6 `xml:"AddtlInf,omitempty"`

	// Party appointed to administer the event on behalf of the issuer company/offeror. The party may be contacted for more information about the event.
	IssuerAgent []*iso20022.PartyIdentification46Choice `xml:"IssrAgt,omitempty"`

	// Agent (principal or fiscal paying agent) appointed to execute the payment for the corporate action event on behalf of the issuer company/offeror.
	PayingAgent []*iso20022.PartyIdentification46Choice `xml:"PngAgt,omitempty"`

	// Sub-agent appointed to execute the payment for the corporate action event on behalf of the issuer company/offeror.
	SubPayingAgent []*iso20022.PartyIdentification46Choice `xml:"SubPngAgt,omitempty"`

	// Party/agent responsible for maintaining the register of a security.
	Registrar *iso20022.PartyIdentification46Choice `xml:"Regar,omitempty"`

	// A broker-dealer responsible for reselling to new investors securities (usually bonds) that have been tendered for purchase by their owner.
	ResellingAgent []*iso20022.PartyIdentification46Choice `xml:"RsellngAgt,omitempty"`

	// A trust company, bank or similar financial institution assigned by an issuer to accept presentations of instruments, usually bonds, for transfer and or exchange.
	PhysicalSecuritiesAgent *iso20022.PartyIdentification46Choice `xml:"PhysSctiesAgt,omitempty"`

	// A trust company, bank or similar financial institution who acts on behalf of an out of town agent or event agent where securities can be delivered in person.
	DropAgent *iso20022.PartyIdentification46Choice `xml:"DrpAgt,omitempty"`

	// A trust company, bank or similar financial institution assigned by an issuer to maintain records of investors and account balances and transactions for the consent of a material change.
	SolicitationAgent []*iso20022.PartyIdentification46Choice `xml:"SlctnAgt,omitempty"`

	// A trust company, bank or similar financial institution assigned by an Issuer to provide information and copies of the offering documentation.
	InformationAgent *iso20022.PartyIdentification46Choice `xml:"InfAgt,omitempty"`

	// Additional information that can not be captured in the structured fields and/or any other specific block.
	SupplementaryData []*iso20022.SupplementaryData1 `xml:"SplmtryData,omitempty"`
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddMovementPreliminaryAdviceGeneralInformation() *iso20022.CorporateActionPreliminaryAdviceType1 {
	c.MovementPreliminaryAdviceGeneralInformation = new(iso20022.CorporateActionPreliminaryAdviceType1)
	return c.MovementPreliminaryAdviceGeneralInformation
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddPreviousMovementPreliminaryAdviceIdentification() *iso20022.DocumentIdentification15 {
	c.PreviousMovementPreliminaryAdviceIdentification = new(iso20022.DocumentIdentification15)
	return c.PreviousMovementPreliminaryAdviceIdentification
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddNotificationIdentification() *iso20022.DocumentIdentification15 {
	c.NotificationIdentification = new(iso20022.DocumentIdentification15)
	return c.NotificationIdentification
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddMovementConfirmationIdentification() *iso20022.DocumentIdentification15 {
	c.MovementConfirmationIdentification = new(iso20022.DocumentIdentification15)
	return c.MovementConfirmationIdentification
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddInstructionIdentification() *iso20022.DocumentIdentification9 {
	c.InstructionIdentification = new(iso20022.DocumentIdentification9)
	return c.InstructionIdentification
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddOtherDocumentIdentification() *iso20022.DocumentIdentification13 {
	newValue := new(iso20022.DocumentIdentification13)
	c.OtherDocumentIdentification = append(c.OtherDocumentIdentification, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddEventsLinkage() *iso20022.CorporateActionEventReference1 {
	newValue := new(iso20022.CorporateActionEventReference1)
	c.EventsLinkage = append(c.EventsLinkage, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddReversalReason() *iso20022.CorporateActionReversalReason1 {
	c.ReversalReason = new(iso20022.CorporateActionReversalReason1)
	return c.ReversalReason
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddCorporateActionGeneralInformation() *iso20022.CorporateActionGeneralInformation23 {
	c.CorporateActionGeneralInformation = new(iso20022.CorporateActionGeneralInformation23)
	return c.CorporateActionGeneralInformation
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddAccountDetails() *iso20022.AccountIdentification12Choice {
	c.AccountDetails = new(iso20022.AccountIdentification12Choice)
	return c.AccountDetails
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddCorporateActionMovementDetails() *iso20022.CorporateActionOption20 {
	newValue := new(iso20022.CorporateActionOption20)
	c.CorporateActionMovementDetails = append(c.CorporateActionMovementDetails, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddAdditionalInformation() *iso20022.CorporateActionNarrative6 {
	c.AdditionalInformation = new(iso20022.CorporateActionNarrative6)
	return c.AdditionalInformation
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddIssuerAgent() *iso20022.PartyIdentification46Choice {
	newValue := new(iso20022.PartyIdentification46Choice)
	c.IssuerAgent = append(c.IssuerAgent, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddPayingAgent() *iso20022.PartyIdentification46Choice {
	newValue := new(iso20022.PartyIdentification46Choice)
	c.PayingAgent = append(c.PayingAgent, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddSubPayingAgent() *iso20022.PartyIdentification46Choice {
	newValue := new(iso20022.PartyIdentification46Choice)
	c.SubPayingAgent = append(c.SubPayingAgent, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddRegistrar() *iso20022.PartyIdentification46Choice {
	c.Registrar = new(iso20022.PartyIdentification46Choice)
	return c.Registrar
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddResellingAgent() *iso20022.PartyIdentification46Choice {
	newValue := new(iso20022.PartyIdentification46Choice)
	c.ResellingAgent = append(c.ResellingAgent, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddPhysicalSecuritiesAgent() *iso20022.PartyIdentification46Choice {
	c.PhysicalSecuritiesAgent = new(iso20022.PartyIdentification46Choice)
	return c.PhysicalSecuritiesAgent
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddDropAgent() *iso20022.PartyIdentification46Choice {
	c.DropAgent = new(iso20022.PartyIdentification46Choice)
	return c.DropAgent
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddSolicitationAgent() *iso20022.PartyIdentification46Choice {
	newValue := new(iso20022.PartyIdentification46Choice)
	c.SolicitationAgent = append(c.SolicitationAgent, newValue)
	return newValue
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddInformationAgent() *iso20022.PartyIdentification46Choice {
	c.InformationAgent = new(iso20022.PartyIdentification46Choice)
	return c.InformationAgent
}

func (c *CorporateActionMovementPreliminaryAdviceV02) AddSupplementaryData() *iso20022.SupplementaryData1 {
	newValue := new(iso20022.SupplementaryData1)
	c.SupplementaryData = append(c.SupplementaryData, newValue)
	return newValue
}


text:
/*
@filename MusicManager.h

Contiene la definición del manager de música del motor de juego de The Eternal Sorrow

Este manager se encarga de registrar y lanzar las pistas correspondientes a músicas de ambiente y banda sonora.

Es un singleton

@author Alberto Martínez Villarán
@date Mayo, 2015
*/

#ifndef __Sounds_MusicManager_H
#define __Sounds_MusicManager_H

#include <map>

namespace Sounds
{
	class CSound;
}

namespace Sounds
{

	class CMusicManager
	{
	public:
		/*
		Devuelve el puntero a la instancia del singleton
		*/
		static Sounds::CMusicManager* getSingletonPtr() { return _instance; }

		/*
		Inicializa la instancia del singleton

		@return True si la inicialización fue correcta
		*/
		static bool Init();

		/*
		Libera la instancia del singleto
		*/
		static void Release();

		void playSound(const std::string &sound);

		void stopSound(const std::string &sound);

		void stopAllSounds();

		void setSoundParameter(const std::string sound, std::string parameter, float value);

	protected:
		/*
		Puntero a la instancia del singleton
		*/
		static CMusicManager* _instance;

		/*
		Constructor por defecto del singleton
		*/
		CMusicManager();

		/*
		Destructor del singleton
		*/
		virtual ~CMusicManager();

		/*
		Método auxiliar para la inicialización del singleton.

		@return True Si la inicialización fue correcta
		*/
		bool open();

		/*
		Método auxiliar para la liberación de los recursos del singleton. Aquí es donde se liberan todos los recursos de FMOD
		*/
		void close();

		CSound* findSound(const std::string &sound);

		typedef std::map<std::string, CSound*> TMapSounds;
		typedef std::pair<std::string, CSound*> TPairSounds;

		TMapSounds _mapSounds;

	};//CMusicManager

};//namespace Sounds

#endif //__Sounds_MusicManager_H


text:
<?php

namespace Mgrt\Wordpress;

use Mgrt\Wordpress\Manager\DataManager;
use Mgrt\Wordpress\Manager\SyncManager;
use Mgrt\Wordpress\Manager\ViewManager;
use Mgrt\Wordpress\Shortcode\NewsletterShortcode;
use Mgrt\Wordpress\Shortcode\CampaignShortcode;

/**
 * Administration panel class
 */
class Bootstrap
{
    private static $instance = null;

    private $dataManager;
    private $viewManager;
    private $syncManager;

    public static function getInstance()
    {
        if (self::$instance == null) {
            self::$instance = new self();
            self::$instance->init_hooks();
        }

        return self::$instance;
    }

    /**
     * Initialize admin panel
     */
    public function init()
    {
        self::getInstance();
    }

    public function getDataManager()
    {
        return $this->dataManager;
    }

    public function getViewManager()
    {
        return $this->viewManager;
    }

    public function getSyncManager()
    {
        return $this->syncManager;
    }

    /**
     * Initialize hooks for administration
     */
    public function init_hooks()
    {
        $this->dataManager = new DataManager($this);
        $this->viewManager = new ViewManager($this);
        $this->syncManager = new SyncManager($this);

        $this->newsletterShortcode  = new NewsletterShortcode();
        $this->campaignShortcode    = new CampaignShortcode();

        wp_register_style('mgrt_public.css', MGRT__PLUGIN_URL.'assets/css/mgrt_public.css', array(), MGRT_VERSION);
        wp_enqueue_style('mgrt_public.css');

        if (is_admin()) {
            add_action('admin_menu', array($this, 'admin_menu'));
            add_action('admin_head', function () {
                echo '';
            });
            add_action('admin_init', array($this, 'admin_init'));
            add_action('admin_notices', array($this, 'display_notice'));
            add_action('admin_enqueue_scripts', array($this, 'load_resources'));

            add_filter('plugin_action_links_'.plugin_basename( MGRT__PLUGIN_DIR.'mgrt.php'), array($this, 'admin_plugin_settings_link'));
        }
    }

    /**
     * Load assets
     */
    public function load_resources()
    {
        if ($this->checkHookSuffix()) {
            wp_register_style('mgrt.css', MGRT__PLUGIN_URL.'assets/css/mgrt.css', array('mgrt_public.css'), MGRT_VERSION);
            wp_enqueue_style('mgrt.css');

            wp_register_script('mgrt.js', MGRT__PLUGIN_URL.'assets/js/mgrt.js', array('jquery'), MGRT_VERSION);
            wp_enqueue_script('mgrt.js');
        }

        if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
            return;
        }

        global $typenow;

        if (!in_array($typenow, array( 'post', 'page'))) {
            return;
        }

        if (get_user_option('rich_editing') == 'true') {
            add_filter('mce_external_plugins', function ($plugin_array)
            {
                $plugin_array['mgrt_tinymce_buttons'] = MGRT__PLUGIN_URL.'assets/js/mgrt_shortcode.js';
                return $plugin_array;
            });
            add_filter('mce_buttons', function ($buttons)
            {
                array_push($buttons, 'mgrt_tinymce_buttons');
                return $buttons;
            });
        }
    }

    /**
     * Display notice
     */
    public function display_notice()
    {
        if ($this->viewManager->hasNotices()) {
            $this->viewManager->displayNotices();
        } else {
            if ($this->checkHookSuffix() && !$this->dataManager->hasKeys()) {
                $this->viewManager->display('Notice', 'install');
            }
        }
    }

    /**
     * Check if hook_suffix is for us
     * @return bool
     */
    private function checkHookSuffix()
    {
        global $hook_suffix;

        return (in_array($hook_suffix, array(
            'index.php', # dashboard
            'plugins.php',
            'users.php',
            'profile.php'
        )) || strpos($hook_suffix, MGRT__OPTION_KEY) !== FALSE);
    }

    /**
     * Add admin menu link
     */
    public function admin_menu()
    {
        $platformName = 'Mgrt';
        if ($this->dataManager->hasKeys()) {
            try {
                $platformName = $this->dataManager->makeCachedApiCall('getAccount')->getPlatformName();
            } catch (\Guzzle\Http\Exception\ServerErrorResponseException $e) {
                $platformName = 'Mgrt';
            } catch (\ErrorException $e) {
                $this->viewManager->sheduleNotice('no_curl');
                return;
            }

            add_menu_page(sprintf(__('plugin.menu.start.1p', 'mgrt-wordpress'), $platformName), $platformName, 'manage_options', MGRT__OPTION_KEY, array($this, 'display_page'), 'dashicons-email');
            add_submenu_page(MGRT__OPTION_KEY, __('plugin.api.key', 'mgrt-wordpress'), __('plugin.api.key', 'mgrt-wordpress'), 'manage_options', MGRT__OPTION_KEY.'-keys', array($this, 'display_page'));

            if ($this->dataManager->getOption('enable_sync')) {
                add_submenu_page(MGRT__OPTION_KEY, __('plugin.menu.sync', 'mgrt-wordpress'), __('plugin.menu.sync', 'mgrt-wordpress'), 'manage_options', MGRT__OPTION_KEY.'-force-sync', array($this, 'display_page'));
            }
        } else {
            add_menu_page(sprintf(__('plugin.menu.start.1p', 'mgrt-wordpress'), $platformName), $platformName, 'manage_options', MGRT__OPTION_KEY.'-keys', array($this, 'display_page'), 'dashicons-email');
        }
    }

    /**
     * Add plugin "Settings" link
     * @param array $links Array of existing links
     */
    public function admin_plugin_settings_link($links)
    {
        $settings_link = 'viewManager->url()).'">'.__('Settings').'';
        array_unshift($links, $settings_link);

        return $links;
    }

    public function admin_init()
    {
        $this->viewManager->initAllViews();
    }

    /**
     * Route input urls
     */
    public function display_page()
    {
        $this->viewManager->route();
    }
}


text:
namespace net {
class URLRequest;
}  // namespace net

namespace content {
FORWARD_DECLARE_TEST(AppCacheGroupTest, CleanupUnusedGroup);
FORWARD_DECLARE_TEST(AppCacheGroupTest, QueueUpdate);
FORWARD_DECLARE_TEST(AppCacheHostTest, FailedCacheLoad);
FORWARD_DECLARE_TEST(AppCacheHostTest, FailedGroupLoad);
FORWARD_DECLARE_TEST(AppCacheHostTest, SetSwappableCache);
FORWARD_DECLARE_TEST(AppCacheTest, CleanupUnusedCache);
class AppCache;
class AppCacheGroupTest;
class AppCacheRequest;
class AppCacheRequestHandler;
class AppCacheRequestHandlerTest;
class AppCacheStorageImplTest;
class AppCacheSubresourceURLFactory;
class AppCacheTest;

namespace appcache_update_job_unittest {
class AppCacheUpdateJobTest;
}

// The browser-side implementation of the document hosting an application cache.
class CONTENT_EXPORT AppCacheHost : public blink::mojom::AppCacheHost,
                                    public AppCacheStorage::Delegate,
                                    public AppCacheGroup::UpdateObserver,
                                    public AppCacheServiceImpl::Observer {
 public:
  class CONTENT_EXPORT Observer {
   public:
    Observer(const Observer&) = delete;
    Observer& operator=(const Observer&) = delete;

    // Called just after the cache selection algorithm completes.
    virtual void OnCacheSelectionComplete(AppCacheHost* host) = 0;

    // Called just prior to the instance being deleted.
    virtual void OnDestructionImminent(AppCacheHost* host) = 0;

   protected:
    // The constructor and destructor exist to facilitate subclassing, and
    // should not be called directly.
    Observer() noexcept = default;
    virtual ~Observer() = default;
  };

  AppCacheHost(
      const base::UnguessableToken& host_id,
      int process_id,
      int render_frame_id,
      mojo::PendingRemote<blink::mojom::AppCacheFrontend> frontend_remote,
      AppCacheServiceImpl* service);
  ~AppCacheHost() override;

  void BindReceiver(mojo::PendingReceiver<blink::mojom::AppCacheHost> receiver);

  // Adds/removes an observer, the AppCacheHost does not take
  // ownership of the observer.
  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

  void Unregister();

  // blink::mojom::AppCacheHost
  void SelectCache(const GURL& document_url,
                   const int64_t cache_document_was_loaded_from,
                   const GURL& manifest_url) override;
  void SelectCacheForWorker(int64_t appcache_id) override;
  void MarkAsForeignEntry(const GURL& document_url,
                          int64_t cache_document_was_loaded_from) override;
  void GetStatus(GetStatusCallback callback) override;
  void StartUpdate(StartUpdateCallback callback) override;
  void SwapCache(SwapCacheCallback callback) override;
  void SetSpawningHostId(
      const base::UnguessableToken& spawning_host_id) override;
  void GetResourceList(GetResourceListCallback callback) override;

  // May return NULL if the spawning host context has been closed, or if a
  // spawning host context was never identified.
  const AppCacheHost* GetSpawningHost() const;

  const GURL& preferred_manifest_url() const { return preferred_manifest_url_; }
  void set_preferred_manifest_url(const GURL& url) {
    preferred_manifest_url_ = url;
  }

  // Support for loading resources out of the appcache.
  // May return NULL if the request isn't subject to retrieval from an appache.
  std::unique_ptr<AppCacheRequestHandler> CreateRequestHandler(
      std::unique_ptr<AppCacheRequest> request,
      blink::mojom::ResourceType resource_type,
      bool should_reset_appcache);

  // Support for devtools inspecting appcache resources.
  void GetResourceListSync(
      std::vector<blink::mojom::AppCacheResourceInfo>* resource_infos);

  // Breaks any existing association between this host and a cache.
  // 'manifest_url' is sent to DevTools as the manifest url that could have
  // been associated before or could be associated later with this host.
  // Associations are broken either thru the cache selection algorithm
  // implemented in this class, or by the update algorithm (see
  // AppCacheUpdateJob).
  void AssociateNoCache(const GURL& manifest_url);

  // Establishes an association between this host and an incomplete cache.
  // 'manifest_url' is manifest url of the cache group being updated.
  // Associations with incomplete caches are established by the update algorithm
  // (see AppCacheUpdateJob).
  void AssociateIncompleteCache(AppCache* cache, const GURL& manifest_url);

  // Establishes an association between this host and a complete cache.
  // Associations with complete caches are established either thru the cache
  // selection algorithm implemented (in this class), or by the update algorithm
  // (see AppCacheUpdateJob).
  void AssociateCompleteCache(AppCache* cache);

  // Adds a reference to the newest complete cache in a group, unless it's the
  // same as the cache that is currently associated with the host.
  void SetSwappableCache(AppCacheGroup* group);

  // Used to ensure that a loaded appcache survives a frame navigation.
  void LoadMainResourceCache(int64_t cache_id);

  // Used to notify the host that a namespace resource is being delivered as
  // the main resource of the page and to provide its url.
  void NotifyMainResourceIsNamespaceEntry(const GURL& namespace_entry_url);

  // Used to notify the host that the main resource was blocked by a policy. To
  // work properly, this method needs to by invoked prior to cache selection.
  void NotifyMainResourceBlocked(const GURL& manifest_url);

  // Used by the update job to keep track of which hosts are associated
  // with which pending master entries.
  const GURL& pending_master_entry_url() const { return new_master_entry_url_; }

  const base::UnguessableToken& host_id() const { return host_id_; }

  int process_id() const {
    DCHECK_NE(process_id_, ChildProcessHost::kInvalidUniqueID);
    return process_id_;
  }

  using SecurityPolicyHandle = ChildProcessSecurityPolicyImpl::Handle;
  SecurityPolicyHandle* security_policy_handle() {
    return &security_policy_handle_;
  }

  // SetProcessId may only be called once, and only if kInvalidUniqueID was
  // passed to the AppCacheHost's constructor (e.g. in a scenario where
  // NavigationRequest needs to delay specifying the |process_id| until
  // ReadyToCommit time).
  void SetProcessId(int process_id);

  AppCacheServiceImpl* service() const { return service_; }
  AppCacheStorage* storage() const { return storage_; }
  blink::mojom::AppCacheFrontend* frontend() const { return frontend_; }

  // The AppCacheHost instance is created with a null AppCacheFrontend
  // pointer when the navigation starts. We need to switch it to the
  // actual frontend when the navigation commits.
  void set_frontend(
      mojo::PendingRemote<blink::mojom::AppCacheFrontend> frontend_remote,
      int render_frame_id) {
    frontend_remote_.Bind(std::move(frontend_remote));
    frontend_ = frontend_remote_.get();
    render_frame_id_ = render_frame_id;
  }

  void set_frontend_for_testing(blink::mojom::AppCacheFrontend* frontend) {
    frontend_ = frontend;
  }

  AppCache* associated_cache() const { return associated_cache_.get(); }

  void enable_cache_selection(bool enable) {
    is_cache_selection_enabled_ = enable;
  }

  bool is_selection_pending() const {
    return pending_selected_cache_id_ != blink::mojom::kAppCacheNoCacheId ||
           !pending_selected_manifest_url_.is_empty();
  }

  const net::SiteForCookies& site_for_cookies() const {
    return site_for_cookies_;
  }
  void SetSiteForCookiesForTesting(
      const net::SiteForCookies& site_for_cookies) {
    site_for_cookies_ = site_for_cookies;
    site_for_cookies_initialized_ = true;
  }

  const base::Optional<url::Origin>& top_frame_origin() const {
    return top_frame_origin_;
  }

  void set_origin_for_url_loader_factory(const url::Origin& origin) {
    origin_for_url_loader_factory_ = origin;
  }

  // Returns a weak pointer reference to the host.
  base::WeakPtr<AppCacheHost> GetWeakPtr();

  // In the network service world, we need to pass the URLLoaderFactory
  // instance to the renderer which it can use to request subresources.
  // This ensures that they can be served out of the AppCache.
  void MaybePassSubresourceFactory();

  // This is called when the frame is navigated to a page which loads from
  // the AppCache.
  void SetAppCacheSubresourceFactory(
      AppCacheSubresourceURLFactory* subresource_factory);

  void OnContentBlocked(const GURL& manifest_url);

  bool IsOriginTrialRequiredForAppCache();

 private:
  friend class content::AppCacheStorageImplTest;
  friend class content::AppCacheRequestHandlerTest;
  friend class content::appcache_update_job_unittest::AppCacheUpdateJobTest;

  blink::mojom::AppCacheStatus GetStatusSync();
  void LoadSelectedCache(int64_t cache_id);
  void LoadOrCreateGroup(const GURL& manifest_url);

  // See public Associate*Host() methods above.
  void AssociateCacheHelper(AppCache* cache, const GURL& manifest_url);

  // AppCacheStorage::Delegate impl
  void OnCacheLoaded(AppCache* cache, int64_t cache_id) override;
  void OnGroupLoaded(AppCacheGroup* group, const GURL& manifest_url) override;
  // AppCacheServiceImpl::Observer impl
  void OnServiceReinitialized(
      AppCacheStorageReference* old_storage_ref) override;

  void FinishCacheSelection(
      AppCache* cache,
      AppCacheGroup* group,
      mojo::ReportBadMessageCallback bad_message_callback);
  void DoPendingGetStatus();
  void DoPendingStartUpdate();
  void DoPendingSwapCache();

  void ObserveGroupBeingUpdated(AppCacheGroup* group);

  // AppCacheGroup::UpdateObserver methods.
  void OnUpdateComplete(AppCacheGroup* group) override;

  void OnAppCacheAccessed(const GURL& manifest_url, bool blocked);

  // Identifies the corresponding appcache host in the child process.
  const base::UnguessableToken host_id_;

  // Identifies the renderer process associated with the AppCacheHost.  Used for
  // selecting the appropriate AppCacheBackend and creating
  // |security_policy_handle_|.
  int process_id_;

  // Security policy handle for the renderer process associated with this
  // AppCacheHost.  Used for performing CanAccessDataForOrigin() security
  // checks.
  //
  // Using this handle allows these checks to work even after the corresponding
  // RenderProcessHost has been destroyed, in the case where there are still
  // in-flight appcache requests that need to be processed. See
  // https://crbug.com/943887.
  SecurityPolicyHandle security_policy_handle_;

  // Information about the host that created this one; the manifest
  // preferred by our creator influences which cache our main resource
  // should be loaded from.
  base::UnguessableToken spawning_host_id_;
  GURL preferred_manifest_url_;

  // Defined prior to refs to AppCaches and Groups because destruction
  // order matters, the disabled_storage_reference_ must outlive those
  // objects. See additional comments for the storage_ member.
  scoped_refptr<AppCacheStorageReference> disabled_storage_reference_;

  // The cache associated with this host, if any.
  scoped_refptr<AppCache> associated_cache_;

  // Hold a reference to the newest complete cache (if associated cache is
  // not the newest) to keep the newest cache in existence while the app cache
  // group is in use. The newest complete cache may have no associated hosts
  // holding any references to it and would otherwise be deleted prematurely.
  scoped_refptr<AppCache> swappable_cache_;

  // Keep a reference to the group being updated until the update completes.
  scoped_refptr<AppCacheGroup> group_being_updated_;

  // Similarly, keep a reference to the newest cache of the group until the
  // update completes. When adding a new master entry to a cache that is not
  // in use in any other host, this reference keeps the cache in  memory.
  scoped_refptr<AppCache> newest_cache_of_group_being_updated_;

  // Keep a reference to the cache of the main resource so it survives frame
  // navigations.
  scoped_refptr<AppCache> main_resource_cache_;
  int64_t pending_main_resource_cache_id_;

  // Cache loading is async. If we're loading a specific cache or group
  // for the purposes of cache selection, one or the other of these will
  // indicate which cache or group is being loaded.
  int64_t pending_selected_cache_id_;
  GURL pending_selected_manifest_url_;

  // Cache loading is async. If we determine after loading that the request to
  // load the cache was actually invalid we can call this callback to report an
  // earlier mojo message as bad to kill the renderer.
  // Unlike the pending*callback_ fields further below in this class, it is
  // fine for this callback to not get called, and as such it is not included
  // in the cleanup code in the destructor.
  mojo::ReportBadMessageCallback pending_selected_cache_bad_message_callback_;

  // Used to defend against bad IPC messages.
  bool was_select_cache_called_;

  // Used to avoid stepping on pages controlled by ServiceWorkers.
  bool is_cache_selection_enabled_;

  // A new master entry to be added to the cache, may be empty.
  GURL new_master_entry_url_;

  // The frontend to deliver notifications to the child process.
  mojo::Remote<blink::mojom::AppCacheFrontend> frontend_remote_;
  blink::mojom::AppCacheFrontend* frontend_;
  int render_frame_id_;

  // Our central service object.
  AppCacheServiceImpl* service_;

  // And the equally central storage object, with a twist. In some error
  // conditions the storage object gets recreated and reinitialized. The
  // disabled_storage_reference_ (defined earlier) allows for cleanup of an
  // instance that got disabled  after we had latched onto it. In normal
  // circumstances, disabled_storage_reference_ is expected to be NULL.
  // When non-NULL both storage_ and disabled_storage_reference_ refer to the
  // same instance.
  AppCacheStorage* storage_;

  // Since these are synchronous scriptable API calls in the client, there can
  // only be one type of callback pending. Also, we have to wait until we have a
  // cache selection prior to responding to these calls, as cache selection
  // involves async loading of a cache or a group from storage.
  // If any of these callbacks are non-null at the time this AppCacheHost is
  // destroyed, we have to make sure that they still get called, as the mojo
  // pipe the callbacks are associated with will outlive this. So make sure to
  // update the destructor if adding more callbacks here.
  GetStatusCallback pending_get_status_callback_;
  StartUpdateCallback pending_start_update_callback_;
  SwapCacheCallback pending_swap_cache_callback_;

  // True if an intercept or fallback namespace resource was
  // delivered as the main resource.
  bool main_resource_was_namespace_entry_;
  GURL namespace_entry_url_;

  // True if requests for this host were blocked by a policy.
  bool main_resource_blocked_;
  GURL blocked_manifest_url_;

  // Tells if info about associated cache is pending. Info is pending
  // when update job has not returned success yet.
  bool associated_cache_info_pending_;

  // List of objects observing us.
  base::ObserverList<Observer>::Unchecked observers_;

  // Used to inform the QuotaManager of what origins are currently in use.
  url::Origin origin_in_use_;

  // The origin used when calling
  // ContentBrowserClient::WillCreateURLLoaderFactory().
  url::Origin origin_for_url_loader_factory_;

  // To be used in policy checks.
  net::SiteForCookies site_for_cookies_;
  bool site_for_cookies_initialized_ = false;
  base::Optional<url::Origin> top_frame_origin_;

  bool is_origin_trial_required_ = false;

  FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, CleanupUnusedGroup);
  FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate);
  FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedCacheLoad);
  FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedGroupLoad);
  FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SetSwappableCache);
  FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache);

  // In the network service world points to the subresource URLLoaderFactory.
  base::WeakPtr<AppCacheSubresourceURLFactory> subresource_url_factory_;

  mojo::Receiver<blink::mojom::AppCacheHost> receiver_{this};

  base::WeakPtrFactory<AppCacheHost> weak_factory_{this};

  DISALLOW_COPY_AND_ASSIGN(AppCacheHost);
};

}  // namespace content

#endif  // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_


text:
<?php

namespace Oro\Bundle\ApiBundle\Util;

use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;

use Oro\Component\EntitySerializer\EntityConfig;
use Oro\Component\EntitySerializer\QueryFactory;
use Oro\Bundle\SecurityBundle\ORM\Walker\AclHelper;

class AclProtectedQueryFactory extends QueryFactory
{
    /** @var AclHelper */
    protected $aclHelper;

    /**
     * @param AclHelper $aclHelper
     */
    public function setAclHelper(AclHelper $aclHelper)
    {
        $this->aclHelper = $aclHelper;
    }

    /**
     * {@inheritdoc}
     */
    public function getQuery(QueryBuilder $qb, EntityConfig $config)
    {
        $query = $this->aclHelper->apply($qb);
        $this->queryHintResolver->resolveHints($query, $config->getHints());

        return $query;
    }
}


text:
module LostAndFoundHelper
end


text:
#include "cairoint.h"

#include "cairo-error-private.h"
#include "cairo-composite-rectangles-private.h"

/* A collection of routines to facilitate writing compositors. */

static inline cairo_bool_t
_cairo_composite_rectangles_init (cairo_composite_rectangles_t *extents,
				  const cairo_rectangle_int_t *surface_extents,
				  cairo_operator_t op,
				  const cairo_pattern_t *source,
				  cairo_clip_t *clip)
{
    extents->unbounded = *surface_extents;

    if (clip != NULL) {
	const cairo_rectangle_int_t *clip_extents;

	clip_extents = _cairo_clip_get_extents (clip);
	if (clip_extents == NULL)
	    return FALSE;

	if (! _cairo_rectangle_intersect (&extents->unbounded, clip_extents))
	    return FALSE;
    }

    extents->bounded = extents->unbounded;
    extents->is_bounded = _cairo_operator_bounded_by_either (op);

    _cairo_pattern_get_extents (source, &extents->source);
    if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_SOURCE) {
	if (! _cairo_rectangle_intersect (&extents->bounded, &extents->source))
	    return FALSE;
    }

    return TRUE;
}

cairo_int_status_t
_cairo_composite_rectangles_init_for_paint (cairo_composite_rectangles_t *extents,
					    const cairo_rectangle_int_t *surface_extents,
					    cairo_operator_t		 op,
					    const cairo_pattern_t	*source,
					    cairo_clip_t		*clip)
{
    if (! _cairo_composite_rectangles_init (extents,
					    surface_extents,
					    op, source, clip))
    {
	return CAIRO_INT_STATUS_NOTHING_TO_DO;
    }

    extents->mask = extents->bounded;
    return CAIRO_STATUS_SUCCESS;
}

static cairo_int_status_t
_cairo_composite_rectangles_intersect (cairo_composite_rectangles_t *extents)
{
    cairo_bool_t ret;

    ret = _cairo_rectangle_intersect (&extents->bounded, &extents->mask);
    if (! ret && extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK)
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    return CAIRO_STATUS_SUCCESS;
}

cairo_int_status_t
_cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents,
					   const cairo_rectangle_int_t *surface_extents,
					   cairo_operator_t		 op,
					   const cairo_pattern_t	*source,
					   const cairo_pattern_t	*mask,
					   cairo_clip_t			*clip)
{
    if (! _cairo_composite_rectangles_init (extents,
					    surface_extents,
					    op, source, clip))
    {
	return CAIRO_INT_STATUS_NOTHING_TO_DO;
    }

    _cairo_pattern_get_extents (mask, &extents->mask);

    return _cairo_composite_rectangles_intersect (extents);
}

cairo_int_status_t
_cairo_composite_rectangles_init_for_stroke (cairo_composite_rectangles_t *extents,
					     const cairo_rectangle_int_t *surface_extents,
					     cairo_operator_t		 op,
					     const cairo_pattern_t	*source,
					     cairo_path_fixed_t		*path,
					     const cairo_stroke_style_t	*style,
					     const cairo_matrix_t	*ctm,
					     cairo_clip_t		*clip)
{
    if (! _cairo_composite_rectangles_init (extents,
					    surface_extents,
					    op, source, clip))
    {
	return CAIRO_INT_STATUS_NOTHING_TO_DO;
    }

    _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &extents->mask);

    return _cairo_composite_rectangles_intersect (extents);
}

cairo_int_status_t
_cairo_composite_rectangles_init_for_fill (cairo_composite_rectangles_t *extents,
					   const cairo_rectangle_int_t *surface_extents,
					   cairo_operator_t		 op,
					   const cairo_pattern_t	*source,
					   cairo_path_fixed_t		*path,
					   cairo_clip_t			*clip)
{
    if (! _cairo_composite_rectangles_init (extents,
					    surface_extents,
					    op, source, clip))
    {
	return CAIRO_INT_STATUS_NOTHING_TO_DO;
    }

    _cairo_path_fixed_approximate_fill_extents (path, &extents->mask);

    return _cairo_composite_rectangles_intersect (extents);
}

cairo_int_status_t
_cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *extents,
					     const cairo_rectangle_int_t *surface_extents,
					     cairo_operator_t		 op,
					     const cairo_pattern_t	*source,
					     cairo_scaled_font_t	*scaled_font,
					     cairo_glyph_t		*glyphs,
					     int			 num_glyphs,
					     cairo_clip_t		*clip,
					     cairo_bool_t		*overlap)
{
    cairo_status_t status;

    if (! _cairo_composite_rectangles_init (extents,
					    surface_extents,
					    op, source, clip))
    {
	return CAIRO_INT_STATUS_NOTHING_TO_DO;
    }

    status = _cairo_scaled_font_glyph_device_extents (scaled_font,
						      glyphs, num_glyphs,
						      &extents->mask,
						      overlap);
    if (unlikely (status))
	return status;

    return _cairo_composite_rectangles_intersect (extents);
}